| File | Statements | Branches | Functions | Lines | |||||
|---|---|---|---|---|---|---|---|---|---|
| example.js | 100% | (83 / 83) | 100% | (73 / 73) | 100% | (12 / 12) | 100% | (83 / 83) | |
| lib.npmtest_semantic_ui_react.js | 100% | (16 / 16) | 100% | (14 / 14) | 100% | (3 / 3) | 100% | (16 / 16) | |
| test.js | 100% | (54 / 54) | 100% | (39 / 39) | 100% | (13 / 13) | 100% | (54 / 54) |
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 | 2 2 2 2 2 2 2 1 2 2 2 2 1 2 2 2 2 2 1 2 1 1 1 1 1 1 1 1 1 2 1 1 1 1 2 2 3 3 3 3 1 3 3 3 1 3 1 1 1 1 1 1 1 1 1 1 1 1 6 6 1 2 1 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 | /*
example.js
quickstart example
instruction
1. save this script as example.js
2. run the shell command:
$ npm install npmtest-semantic-ui-react && PORT=8081 node example.js
3. play with the browser-demo on http://127.0.0.1:8081
*/
/* istanbul instrument in package npmtest_semantic_ui_react */
/*jslint
bitwise: true,
browser: true,
maxerr: 8,
maxlen: 96,
node: true,
nomen: true,
regexp: true,
stupid: true
*/
(function () {
'use strict';
var local;
// run shared js-env code - pre-init
(function () {
// init local
local = {};
// init modeJs
local.modeJs = (function () {
try {
return typeof navigator.userAgent === 'string' &&
typeof document.querySelector('body') === 'object' &&
typeof XMLHttpRequest.prototype.open === 'function' &&
'browser';
} catch (errorCaughtBrowser) {
return module.exports &&
typeof process.versions.node === 'string' &&
typeof require('http').createServer === 'function' &&
'node';
}
}());
// init global
local.global = local.modeJs === 'browser'
? window
: global;
// init utility2_rollup
local = local.global.utility2_rollup || (local.modeJs === 'browser'
? local.global.utility2_npmtest_semantic_ui_react
: global.utility2_moduleExports);
// export local
local.global.local = local;
}());
switch (local.modeJs) {
// post-init
// run browser js-env code - post-init
/* istanbul ignore next */
case 'browser':
local.testRunBrowser = function (event) {
Eif (!event || (event &&
event.currentTarget &&
event.currentTarget.className &&
event.currentTarget.className.includes &&
event.currentTarget.className.includes('onreset'))) {
// reset output
Array.from(
document.querySelectorAll('body > .resettable')
).forEach(function (element) {
switch (element.tagName) {
case 'INPUT':
case 'TEXTAREA':
element.value = '';
break;
default:
element.textContent = '';
}
});
}
switch (event && event.currentTarget && event.currentTarget.id) {
case 'testRunButton1':
// show tests
Eif (document.querySelector('#testReportDiv1').style.display === 'none') {
document.querySelector('#testReportDiv1').style.display = 'block';
document.querySelector('#testRunButton1').textContent =
'hide internal test';
local.modeTest = true;
local.testRunDefault(local);
// hide tests
} else {
document.querySelector('#testReportDiv1').style.display = 'none';
document.querySelector('#testRunButton1').textContent = 'run internal test';
}
break;
// custom-case
default:
break;
}
Iif (document.querySelector('#inputTextareaEval1') && (!event || (event &&
event.currentTarget &&
event.currentTarget.className &&
event.currentTarget.className.includes &&
event.currentTarget.className.includes('oneval')))) {
// try to eval input-code
try {
/*jslint evil: true*/
eval(document.querySelector('#inputTextareaEval1').value);
} catch (errorCaught) {
console.error(errorCaught);
}
}
};
// log stderr and stdout to #outputTextareaStdout1
['error', 'log'].forEach(function (key) {
console[key + '_original'] = console[key];
console[key] = function () {
var element;
console[key + '_original'].apply(console, arguments);
element = document.querySelector('#outputTextareaStdout1');
Iif (!element) {
return;
}
// append text to #outputTextareaStdout1
element.value += Array.from(arguments).map(function (arg) {
return typeof arg === 'string'
? arg
: JSON.stringify(arg, null, 4);
}).join(' ') + '\n';
// scroll textarea to bottom
element.scrollTop = element.scrollHeight;
};
});
// init event-handling
['change', 'click', 'keyup'].forEach(function (event) {
Array.from(document.querySelectorAll('.on' + event)).forEach(function (element) {
element.addEventListener(event, local.testRunBrowser);
});
});
// run tests
local.testRunBrowser();
break;
// run node js-env code - post-init
/* istanbul ignore next */
case 'node':
// export local
module.exports = local;
// require modules
local.fs = require('fs');
local.http = require('http');
local.url = require('url');
// init assets
local.assetsDict = local.assetsDict || {};
/* jslint-ignore-begin */
local.assetsDict['/assets.index.template.html'] = '\
<!doctype html>\n\
<html lang="en">\n\
<head>\n\
<meta charset="UTF-8">\n\
<meta name="viewport" content="width=device-width, initial-scale=1">\n\
<title>{{env.npm_package_name}} (v{{env.npm_package_version}})</title>\n\
<style>\n\
/*csslint\n\
box-sizing: false,\n\
universal-selector: false\n\
*/\n\
* {\n\
box-sizing: border-box;\n\
}\n\
body {\n\
background: #dde;\n\
font-family: Arial, Helvetica, sans-serif;\n\
margin: 2rem;\n\
}\n\
body > * {\n\
margin-bottom: 1rem;\n\
}\n\
.utility2FooterDiv {\n\
margin-top: 20px;\n\
text-align: center;\n\
}\n\
</style>\n\
<style>\n\
/*csslint\n\
*/\n\
textarea {\n\
font-family: monospace;\n\
height: 10rem;\n\
width: 100%;\n\
}\n\
textarea[readonly] {\n\
background: #ddd;\n\
}\n\
</style>\n\
</head>\n\
<body>\n\
<!-- utility2-comment\n\
<div id="ajaxProgressDiv1" style="background: #d00; height: 2px; left: 0; margin: 0; padding: 0; position: fixed; top: 0; transition: background 0.5s, width 1.5s; width: 25%;"></div>\n\
utility2-comment -->\n\
<h1>\n\
<!-- utility2-comment\n\
<a\n\
{{#if env.npm_package_homepage}}\n\
href="{{env.npm_package_homepage}}"\n\
{{/if env.npm_package_homepage}}\n\
target="_blank"\n\
>\n\
utility2-comment -->\n\
{{env.npm_package_name}} (v{{env.npm_package_version}})\n\
<!-- utility2-comment\n\
</a>\n\
utility2-comment -->\n\
</h1>\n\
<h3>{{env.npm_package_description}}</h3>\n\
<!-- utility2-comment\n\
<h4><a download href="assets.app.js">download standalone app</a></h4>\n\
<button class="onclick onreset" id="testRunButton1">run internal test</button><br>\n\
<div id="testReportDiv1" style="display: none;"></div>\n\
utility2-comment -->\n\
\n\
\n\
\n\
<label>stderr and stdout</label>\n\
<textarea class="resettable" id="outputTextareaStdout1" readonly></textarea>\n\
<!-- utility2-comment\n\
{{#if isRollup}}\n\
<script src="assets.app.js"></script>\n\
{{#unless isRollup}}\n\
utility2-comment -->\n\
<script src="assets.utility2.rollup.js"></script>\n\
<script src="jsonp.utility2._stateInit?callback=window.utility2._stateInit"></script>\n\
<script src="assets.npmtest_semantic_ui_react.rollup.js"></script>\n\
<script src="assets.example.js"></script>\n\
<script src="assets.test.js"></script>\n\
<!-- utility2-comment\n\
{{/if isRollup}}\n\
utility2-comment -->\n\
<div class="utility2FooterDiv">\n\
[ this app was created with\n\
<a href="https://github.com/kaizhu256/node-utility2" target="_blank">utility2</a>\n\
]\n\
</div>\n\
</body>\n\
</html>\n\
';
/* jslint-ignore-end */
Iif (local.templateRender) {
local.assetsDict['/'] = local.templateRender(
local.assetsDict['/assets.index.template.html'],
{
env: local.objectSetDefault(local.env, {
npm_package_description: 'the greatest app in the world!',
npm_package_name: 'my-app',
npm_package_nameAlias: 'my_app',
npm_package_version: '0.0.1'
})
}
);
} else {
local.assetsDict['/'] = local.assetsDict['/assets.index.template.html']
.replace((/\{\{env\.(\w+?)\}\}/g), function (match0, match1) {
// jslint-hack
String(match0);
switch (match1) {
case 'npm_package_description':
return 'the greatest app in the world!';
case 'npm_package_name':
return 'my-app';
case 'npm_package_nameAlias':
return 'my_app';
case 'npm_package_version':
return '0.0.1';
}
});
}
// run the cli
Eif (local.global.utility2_rollup || module !== require.main) {
break;
}
local.assetsDict['/assets.example.js'] =
local.assetsDict['/assets.example.js'] ||
local.fs.readFileSync(__filename, 'utf8');
// bug-workaround - long $npm_package_buildCustomOrg
/* jslint-ignore-begin */
local.assetsDict['/assets.npmtest_semantic_ui_react.rollup.js'] =
local.assetsDict['/assets.npmtest_semantic_ui_react.rollup.js'] ||
local.fs.readFileSync(
local.npmtest_semantic_ui_react.__dirname + '/lib.npmtest_semantic_ui_react.js',
'utf8'
).replace((/^#!/), '//');
/* jslint-ignore-end */
local.assetsDict['/favicon.ico'] = local.assetsDict['/favicon.ico'] || '';
// if $npm_config_timeout_exit exists,
// then exit this process after $npm_config_timeout_exit ms
if (Number(process.env.npm_config_timeout_exit)) {
setTimeout(process.exit, Number(process.env.npm_config_timeout_exit));
}
// start server
if (local.global.utility2_serverHttp1) {
break;
}
process.env.PORT = process.env.PORT || '8081';
console.error('server starting on port ' + process.env.PORT);
local.http.createServer(function (request, response) {
request.urlParsed = local.url.parse(request.url);
if (local.assetsDict[request.urlParsed.pathname] !== undefined) {
response.end(local.assetsDict[request.urlParsed.pathname]);
return;
}
response.statusCode = 404;
response.end();
}).listen(process.env.PORT);
break;
}
}());
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 | 2 2 2 2 2 2 2 1 2 2 2 2 1 1 1 1 | /* istanbul instrument in package npmtest_semantic_ui_react */
/*jslint
bitwise: true,
browser: true,
maxerr: 8,
maxlen: 96,
node: true,
nomen: true,
regexp: true,
stupid: true
*/
(function () {
'use strict';
var local;
// run shared js-env code - pre-init
(function () {
// init local
local = {};
// init modeJs
local.modeJs = (function () {
try {
return typeof navigator.userAgent === 'string' &&
typeof document.querySelector('body') === 'object' &&
typeof XMLHttpRequest.prototype.open === 'function' &&
'browser';
} catch (errorCaughtBrowser) {
return module.exports &&
typeof process.versions.node === 'string' &&
typeof require('http').createServer === 'function' &&
'node';
}
}());
// init global
local.global = local.modeJs === 'browser'
? window
: global;
// init utility2_rollup
local = local.global.utility2_rollup || local;
// init lib
local.local = local.npmtest_semantic_ui_react = local;
// init exports
if (local.modeJs === 'browser') {
local.global.utility2_npmtest_semantic_ui_react = local;
} else {
module.exports = local;
module.exports.__dirname = __dirname;
module.exports.module = module;
}
}());
}());
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 | 2 2 2 2 2 2 2 1 2 2 1 1 1 1 2 2 2 2 1 1 2 2 2 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 1 2 2 1 2 2 1 2 2 1 1 1 1 1 | /* istanbul instrument in package npmtest_semantic_ui_react */
/*jslint
bitwise: true,
browser: true,
maxerr: 8,
maxlen: 96,
node: true,
nomen: true,
regexp: true,
stupid: true
*/
(function () {
'use strict';
var local;
// run shared js-env code - pre-init
(function () {
// init local
local = {};
// init modeJs
local.modeJs = (function () {
try {
return typeof navigator.userAgent === 'string' &&
typeof document.querySelector('body') === 'object' &&
typeof XMLHttpRequest.prototype.open === 'function' &&
'browser';
} catch (errorCaughtBrowser) {
return module.exports &&
typeof process.versions.node === 'string' &&
typeof require('http').createServer === 'function' &&
'node';
}
}());
// init global
local.global = local.modeJs === 'browser'
? window
: global;
switch (local.modeJs) {
// re-init local from window.local
case 'browser':
local = local.global.utility2.objectSetDefault(
local.global.utility2_rollup || local.global.local,
local.global.utility2
);
break;
// re-init local from example.js
case 'node':
local = (local.global.utility2_rollup || require('utility2'))
.requireReadme();
break;
}
// export local
local.global.local = local;
}());
// run shared js-env code - function
(function () {
return;
}());
switch (local.modeJs) {
// run browser js-env code - function
case 'browser':
break;
// run node js-env code - function
case 'node':
break;
}
// run shared js-env code - post-init
(function () {
return;
}());
switch (local.modeJs) {
// run browser js-env code - post-init
case 'browser':
local.testCase_browser_nullCase = local.testCase_browser_nullCase || function (
options,
onError
) {
/*
* this function will test browsers's null-case handling-behavior-behavior
*/
onError(null, options);
};
// run tests
local.nop(local.modeTest &&
document.querySelector('#testRunButton1') &&
document.querySelector('#testRunButton1').click());
break;
// run node js-env code - post-init
/* istanbul ignore next */
case 'node':
local.testCase_buildApidoc_default = local.testCase_buildApidoc_default || function (
options,
onError
) {
/*
* this function will test buildApidoc's default handling-behavior-behavior
*/
options = { modulePathList: module.paths };
local.buildApidoc(options, onError);
};
local.testCase_buildApp_default = local.testCase_buildApp_default || function (
options,
onError
) {
/*
* this function will test buildApp's default handling-behavior-behavior
*/
local.testCase_buildReadme_default(options, local.onErrorThrow);
local.testCase_buildLib_default(options, local.onErrorThrow);
local.testCase_buildTest_default(options, local.onErrorThrow);
local.testCase_buildCustomOrg_default(options, local.onErrorThrow);
options = [];
local.buildApp(options, onError);
};
local.testCase_buildCustomOrg_default = local.testCase_buildCustomOrg_default ||
function (options, onError) {
/*
* this function will test buildCustomOrg's default handling-behavior
*/
options = {};
local.buildCustomOrg(options, onError);
};
local.testCase_buildLib_default = local.testCase_buildLib_default || function (
options,
onError
) {
/*
* this function will test buildLib's default handling-behavior
*/
options = {};
local.buildLib(options, onError);
};
local.testCase_buildReadme_default = local.testCase_buildReadme_default || function (
options,
onError
) {
/*
* this function will test buildReadme's default handling-behavior-behavior
*/
options = {};
local.buildReadme(options, onError);
};
local.testCase_buildTest_default = local.testCase_buildTest_default || function (
options,
onError
) {
/*
* this function will test buildTest's default handling-behavior
*/
options = {};
local.buildTest(options, onError);
};
local.testCase_webpage_default = local.testCase_webpage_default || function (
options,
onError
) {
/*
* this function will test webpage's default handling-behavior
*/
options = { modeCoverageMerge: true, url: local.serverLocalHost + '?modeTest=1' };
local.browserTest(options, onError);
};
// run test-server
local.testRunServer(local);
break;
}
}());
|
| File | Statements | Branches | Functions | Lines | |||||
|---|---|---|---|---|---|---|---|---|---|
| index.js | 100% | (426 / 426) | 75% | (3 / 4) | 100% | (142 / 142) | 100% | (425 / 425) |
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 | 1 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 1 1 2 282 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _Confirm = require('./addons/Confirm');
Object.defineProperty(exports, 'Confirm', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_Confirm).default;
}
});
var _Portal = require('./addons/Portal');
Object.defineProperty(exports, 'Portal', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_Portal).default;
}
});
var _Radio = require('./addons/Radio');
Object.defineProperty(exports, 'Radio', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_Radio).default;
}
});
var _Select = require('./addons/Select');
Object.defineProperty(exports, 'Select', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_Select).default;
}
});
var _TextArea = require('./addons/TextArea');
Object.defineProperty(exports, 'TextArea', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_TextArea).default;
}
});
var _Breadcrumb = require('./collections/Breadcrumb');
Object.defineProperty(exports, 'Breadcrumb', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_Breadcrumb).default;
}
});
var _BreadcrumbDivider = require('./collections/Breadcrumb/BreadcrumbDivider');
Object.defineProperty(exports, 'BreadcrumbDivider', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_BreadcrumbDivider).default;
}
});
var _BreadcrumbSection = require('./collections/Breadcrumb/BreadcrumbSection');
Object.defineProperty(exports, 'BreadcrumbSection', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_BreadcrumbSection).default;
}
});
var _Form = require('./collections/Form');
Object.defineProperty(exports, 'Form', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_Form).default;
}
});
var _FormButton = require('./collections/Form/FormButton');
Object.defineProperty(exports, 'FormButton', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_FormButton).default;
}
});
var _FormCheckbox = require('./collections/Form/FormCheckbox');
Object.defineProperty(exports, 'FormCheckbox', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_FormCheckbox).default;
}
});
var _FormDropdown = require('./collections/Form/FormDropdown');
Object.defineProperty(exports, 'FormDropdown', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_FormDropdown).default;
}
});
var _FormField = require('./collections/Form/FormField');
Object.defineProperty(exports, 'FormField', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_FormField).default;
}
});
var _FormGroup = require('./collections/Form/FormGroup');
Object.defineProperty(exports, 'FormGroup', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_FormGroup).default;
}
});
var _FormInput = require('./collections/Form/FormInput');
Object.defineProperty(exports, 'FormInput', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_FormInput).default;
}
});
var _FormRadio = require('./collections/Form/FormRadio');
Object.defineProperty(exports, 'FormRadio', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_FormRadio).default;
}
});
var _FormSelect = require('./collections/Form/FormSelect');
Object.defineProperty(exports, 'FormSelect', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_FormSelect).default;
}
});
var _FormTextArea = require('./collections/Form/FormTextArea');
Object.defineProperty(exports, 'FormTextArea', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_FormTextArea).default;
}
});
var _Grid = require('./collections/Grid');
Object.defineProperty(exports, 'Grid', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_Grid).default;
}
});
var _GridColumn = require('./collections/Grid/GridColumn');
Object.defineProperty(exports, 'GridColumn', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_GridColumn).default;
}
});
var _GridRow = require('./collections/Grid/GridRow');
Object.defineProperty(exports, 'GridRow', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_GridRow).default;
}
});
var _Menu = require('./collections/Menu');
Object.defineProperty(exports, 'Menu', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_Menu).default;
}
});
var _MenuHeader = require('./collections/Menu/MenuHeader');
Object.defineProperty(exports, 'MenuHeader', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_MenuHeader).default;
}
});
var _MenuItem = require('./collections/Menu/MenuItem');
Object.defineProperty(exports, 'MenuItem', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_MenuItem).default;
}
});
var _MenuMenu = require('./collections/Menu/MenuMenu');
Object.defineProperty(exports, 'MenuMenu', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_MenuMenu).default;
}
});
var _Message = require('./collections/Message');
Object.defineProperty(exports, 'Message', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_Message).default;
}
});
var _MessageContent = require('./collections/Message/MessageContent');
Object.defineProperty(exports, 'MessageContent', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_MessageContent).default;
}
});
var _MessageHeader = require('./collections/Message/MessageHeader');
Object.defineProperty(exports, 'MessageHeader', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_MessageHeader).default;
}
});
var _MessageItem = require('./collections/Message/MessageItem');
Object.defineProperty(exports, 'MessageItem', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_MessageItem).default;
}
});
var _MessageList = require('./collections/Message/MessageList');
Object.defineProperty(exports, 'MessageList', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_MessageList).default;
}
});
var _Table = require('./collections/Table');
Object.defineProperty(exports, 'Table', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_Table).default;
}
});
var _TableBody = require('./collections/Table/TableBody');
Object.defineProperty(exports, 'TableBody', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_TableBody).default;
}
});
var _TableCell = require('./collections/Table/TableCell');
Object.defineProperty(exports, 'TableCell', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_TableCell).default;
}
});
var _TableFooter = require('./collections/Table/TableFooter');
Object.defineProperty(exports, 'TableFooter', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_TableFooter).default;
}
});
var _TableHeader = require('./collections/Table/TableHeader');
Object.defineProperty(exports, 'TableHeader', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_TableHeader).default;
}
});
var _TableHeaderCell = require('./collections/Table/TableHeaderCell');
Object.defineProperty(exports, 'TableHeaderCell', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_TableHeaderCell).default;
}
});
var _TableRow = require('./collections/Table/TableRow');
Object.defineProperty(exports, 'TableRow', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_TableRow).default;
}
});
var _Button = require('./elements/Button/Button');
Object.defineProperty(exports, 'Button', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_Button).default;
}
});
var _ButtonContent = require('./elements/Button/ButtonContent');
Object.defineProperty(exports, 'ButtonContent', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_ButtonContent).default;
}
});
var _ButtonGroup = require('./elements/Button/ButtonGroup');
Object.defineProperty(exports, 'ButtonGroup', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_ButtonGroup).default;
}
});
var _ButtonOr = require('./elements/Button/ButtonOr');
Object.defineProperty(exports, 'ButtonOr', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_ButtonOr).default;
}
});
var _Container = require('./elements/Container');
Object.defineProperty(exports, 'Container', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_Container).default;
}
});
var _Divider = require('./elements/Divider');
Object.defineProperty(exports, 'Divider', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_Divider).default;
}
});
var _Flag = require('./elements/Flag');
Object.defineProperty(exports, 'Flag', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_Flag).default;
}
});
var _Header = require('./elements/Header');
Object.defineProperty(exports, 'Header', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_Header).default;
}
});
var _HeaderContent = require('./elements/Header/HeaderContent');
Object.defineProperty(exports, 'HeaderContent', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_HeaderContent).default;
}
});
var _HeaderSubheader = require('./elements/Header/HeaderSubheader');
Object.defineProperty(exports, 'HeaderSubheader', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_HeaderSubheader).default;
}
});
var _Icon = require('./elements/Icon');
Object.defineProperty(exports, 'Icon', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_Icon).default;
}
});
var _IconGroup = require('./elements/Icon/IconGroup');
Object.defineProperty(exports, 'IconGroup', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_IconGroup).default;
}
});
var _Image = require('./elements/Image');
Object.defineProperty(exports, 'Image', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_Image).default;
}
});
var _ImageGroup = require('./elements/Image/ImageGroup');
Object.defineProperty(exports, 'ImageGroup', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_ImageGroup).default;
}
});
var _Input = require('./elements/Input');
Object.defineProperty(exports, 'Input', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_Input).default;
}
});
var _Label = require('./elements/Label');
Object.defineProperty(exports, 'Label', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_Label).default;
}
});
var _LabelDetail = require('./elements/Label/LabelDetail');
Object.defineProperty(exports, 'LabelDetail', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_LabelDetail).default;
}
});
var _LabelGroup = require('./elements/Label/LabelGroup');
Object.defineProperty(exports, 'LabelGroup', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_LabelGroup).default;
}
});
var _List = require('./elements/List');
Object.defineProperty(exports, 'List', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_List).default;
}
});
var _ListContent = require('./elements/List/ListContent');
Object.defineProperty(exports, 'ListContent', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_ListContent).default;
}
});
var _ListDescription = require('./elements/List/ListDescription');
Object.defineProperty(exports, 'ListDescription', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_ListDescription).default;
}
});
var _ListHeader = require('./elements/List/ListHeader');
Object.defineProperty(exports, 'ListHeader', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_ListHeader).default;
}
});
var _ListIcon = require('./elements/List/ListIcon');
Object.defineProperty(exports, 'ListIcon', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_ListIcon).default;
}
});
var _ListItem = require('./elements/List/ListItem');
Object.defineProperty(exports, 'ListItem', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_ListItem).default;
}
});
var _ListList = require('./elements/List/ListList');
Object.defineProperty(exports, 'ListList', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_ListList).default;
}
});
var _Loader = require('./elements/Loader');
Object.defineProperty(exports, 'Loader', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_Loader).default;
}
});
var _Rail = require('./elements/Rail');
Object.defineProperty(exports, 'Rail', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_Rail).default;
}
});
var _Reveal = require('./elements/Reveal');
Object.defineProperty(exports, 'Reveal', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_Reveal).default;
}
});
var _RevealContent = require('./elements/Reveal/RevealContent');
Object.defineProperty(exports, 'RevealContent', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_RevealContent).default;
}
});
var _Segment = require('./elements/Segment');
Object.defineProperty(exports, 'Segment', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_Segment).default;
}
});
var _SegmentGroup = require('./elements/Segment/SegmentGroup');
Object.defineProperty(exports, 'SegmentGroup', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_SegmentGroup).default;
}
});
var _Step = require('./elements/Step');
Object.defineProperty(exports, 'Step', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_Step).default;
}
});
var _StepContent = require('./elements/Step/StepContent');
Object.defineProperty(exports, 'StepContent', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_StepContent).default;
}
});
var _StepDescription = require('./elements/Step/StepDescription');
Object.defineProperty(exports, 'StepDescription', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_StepDescription).default;
}
});
var _StepGroup = require('./elements/Step/StepGroup');
Object.defineProperty(exports, 'StepGroup', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_StepGroup).default;
}
});
var _StepTitle = require('./elements/Step/StepTitle');
Object.defineProperty(exports, 'StepTitle', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_StepTitle).default;
}
});
var _Accordion = require('./modules/Accordion/Accordion');
Object.defineProperty(exports, 'Accordion', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_Accordion).default;
}
});
var _AccordionContent = require('./modules/Accordion/AccordionContent');
Object.defineProperty(exports, 'AccordionContent', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_AccordionContent).default;
}
});
var _AccordionTitle = require('./modules/Accordion/AccordionTitle');
Object.defineProperty(exports, 'AccordionTitle', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_AccordionTitle).default;
}
});
var _Checkbox = require('./modules/Checkbox');
Object.defineProperty(exports, 'Checkbox', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_Checkbox).default;
}
});
var _Dimmer = require('./modules/Dimmer');
Object.defineProperty(exports, 'Dimmer', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_Dimmer).default;
}
});
var _DimmerDimmable = require('./modules/Dimmer/DimmerDimmable');
Object.defineProperty(exports, 'DimmerDimmable', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_DimmerDimmable).default;
}
});
var _Dropdown = require('./modules/Dropdown');
Object.defineProperty(exports, 'Dropdown', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_Dropdown).default;
}
});
var _DropdownDivider = require('./modules/Dropdown/DropdownDivider');
Object.defineProperty(exports, 'DropdownDivider', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_DropdownDivider).default;
}
});
var _DropdownHeader = require('./modules/Dropdown/DropdownHeader');
Object.defineProperty(exports, 'DropdownHeader', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_DropdownHeader).default;
}
});
var _DropdownItem = require('./modules/Dropdown/DropdownItem');
Object.defineProperty(exports, 'DropdownItem', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_DropdownItem).default;
}
});
var _DropdownMenu = require('./modules/Dropdown/DropdownMenu');
Object.defineProperty(exports, 'DropdownMenu', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_DropdownMenu).default;
}
});
var _Embed = require('./modules/Embed');
Object.defineProperty(exports, 'Embed', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_Embed).default;
}
});
var _Modal = require('./modules/Modal');
Object.defineProperty(exports, 'Modal', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_Modal).default;
}
});
var _ModalActions = require('./modules/Modal/ModalActions');
Object.defineProperty(exports, 'ModalActions', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_ModalActions).default;
}
});
var _ModalContent = require('./modules/Modal/ModalContent');
Object.defineProperty(exports, 'ModalContent', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_ModalContent).default;
}
});
var _ModalDescription = require('./modules/Modal/ModalDescription');
Object.defineProperty(exports, 'ModalDescription', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_ModalDescription).default;
}
});
var _ModalHeader = require('./modules/Modal/ModalHeader');
Object.defineProperty(exports, 'ModalHeader', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_ModalHeader).default;
}
});
var _Popup = require('./modules/Popup');
Object.defineProperty(exports, 'Popup', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_Popup).default;
}
});
var _PopupContent = require('./modules/Popup/PopupContent');
Object.defineProperty(exports, 'PopupContent', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_PopupContent).default;
}
});
var _PopupHeader = require('./modules/Popup/PopupHeader');
Object.defineProperty(exports, 'PopupHeader', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_PopupHeader).default;
}
});
var _Progress = require('./modules/Progress');
Object.defineProperty(exports, 'Progress', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_Progress).default;
}
});
var _Rating = require('./modules/Rating');
Object.defineProperty(exports, 'Rating', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_Rating).default;
}
});
var _RatingIcon = require('./modules/Rating/RatingIcon');
Object.defineProperty(exports, 'RatingIcon', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_RatingIcon).default;
}
});
var _Search = require('./modules/Search');
Object.defineProperty(exports, 'Search', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_Search).default;
}
});
var _SearchCategory = require('./modules/Search/SearchCategory');
Object.defineProperty(exports, 'SearchCategory', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_SearchCategory).default;
}
});
var _SearchResult = require('./modules/Search/SearchResult');
Object.defineProperty(exports, 'SearchResult', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_SearchResult).default;
}
});
var _SearchResults = require('./modules/Search/SearchResults');
Object.defineProperty(exports, 'SearchResults', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_SearchResults).default;
}
});
var _Sidebar = require('./modules/Sidebar');
Object.defineProperty(exports, 'Sidebar', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_Sidebar).default;
}
});
var _SidebarPushable = require('./modules/Sidebar/SidebarPushable');
Object.defineProperty(exports, 'SidebarPushable', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_SidebarPushable).default;
}
});
var _SidebarPusher = require('./modules/Sidebar/SidebarPusher');
Object.defineProperty(exports, 'SidebarPusher', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_SidebarPusher).default;
}
});
var _Advertisement = require('./views/Advertisement');
Object.defineProperty(exports, 'Advertisement', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_Advertisement).default;
}
});
var _Card = require('./views/Card/Card');
Object.defineProperty(exports, 'Card', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_Card).default;
}
});
var _CardContent = require('./views/Card/CardContent');
Object.defineProperty(exports, 'CardContent', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_CardContent).default;
}
});
var _CardDescription = require('./views/Card/CardDescription');
Object.defineProperty(exports, 'CardDescription', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_CardDescription).default;
}
});
var _CardGroup = require('./views/Card/CardGroup');
Object.defineProperty(exports, 'CardGroup', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_CardGroup).default;
}
});
var _CardHeader = require('./views/Card/CardHeader');
Object.defineProperty(exports, 'CardHeader', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_CardHeader).default;
}
});
var _CardMeta = require('./views/Card/CardMeta');
Object.defineProperty(exports, 'CardMeta', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_CardMeta).default;
}
});
var _Comment = require('./views/Comment');
Object.defineProperty(exports, 'Comment', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_Comment).default;
}
});
var _CommentAction = require('./views/Comment/CommentAction');
Object.defineProperty(exports, 'CommentAction', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_CommentAction).default;
}
});
var _CommentActions = require('./views/Comment/CommentActions');
Object.defineProperty(exports, 'CommentActions', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_CommentActions).default;
}
});
var _CommentAuthor = require('./views/Comment/CommentAuthor');
Object.defineProperty(exports, 'CommentAuthor', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_CommentAuthor).default;
}
});
var _CommentAvatar = require('./views/Comment/CommentAvatar');
Object.defineProperty(exports, 'CommentAvatar', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_CommentAvatar).default;
}
});
var _CommentContent = require('./views/Comment/CommentContent');
Object.defineProperty(exports, 'CommentContent', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_CommentContent).default;
}
});
var _CommentGroup = require('./views/Comment/CommentGroup');
Object.defineProperty(exports, 'CommentGroup', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_CommentGroup).default;
}
});
var _CommentMetadata = require('./views/Comment/CommentMetadata');
Object.defineProperty(exports, 'CommentMetadata', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_CommentMetadata).default;
}
});
var _CommentText = require('./views/Comment/CommentText');
Object.defineProperty(exports, 'CommentText', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_CommentText).default;
}
});
var _Feed = require('./views/Feed');
Object.defineProperty(exports, 'Feed', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_Feed).default;
}
});
var _FeedContent = require('./views/Feed/FeedContent');
Object.defineProperty(exports, 'FeedContent', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_FeedContent).default;
}
});
var _FeedDate = require('./views/Feed/FeedDate');
Object.defineProperty(exports, 'FeedDate', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_FeedDate).default;
}
});
var _FeedEvent = require('./views/Feed/FeedEvent');
Object.defineProperty(exports, 'FeedEvent', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_FeedEvent).default;
}
});
var _FeedExtra = require('./views/Feed/FeedExtra');
Object.defineProperty(exports, 'FeedExtra', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_FeedExtra).default;
}
});
var _FeedLabel = require('./views/Feed/FeedLabel');
Object.defineProperty(exports, 'FeedLabel', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_FeedLabel).default;
}
});
var _FeedLike = require('./views/Feed/FeedLike');
Object.defineProperty(exports, 'FeedLike', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_FeedLike).default;
}
});
var _FeedMeta = require('./views/Feed/FeedMeta');
Object.defineProperty(exports, 'FeedMeta', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_FeedMeta).default;
}
});
var _FeedSummary = require('./views/Feed/FeedSummary');
Object.defineProperty(exports, 'FeedSummary', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_FeedSummary).default;
}
});
var _FeedUser = require('./views/Feed/FeedUser');
Object.defineProperty(exports, 'FeedUser', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_FeedUser).default;
}
});
var _Item = require('./views/Item');
Object.defineProperty(exports, 'Item', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_Item).default;
}
});
var _ItemContent = require('./views/Item/ItemContent');
Object.defineProperty(exports, 'ItemContent', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_ItemContent).default;
}
});
var _ItemDescription = require('./views/Item/ItemDescription');
Object.defineProperty(exports, 'ItemDescription', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_ItemDescription).default;
}
});
var _ItemExtra = require('./views/Item/ItemExtra');
Object.defineProperty(exports, 'ItemExtra', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_ItemExtra).default;
}
});
var _ItemGroup = require('./views/Item/ItemGroup');
Object.defineProperty(exports, 'ItemGroup', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_ItemGroup).default;
}
});
var _ItemHeader = require('./views/Item/ItemHeader');
Object.defineProperty(exports, 'ItemHeader', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_ItemHeader).default;
}
});
var _ItemImage = require('./views/Item/ItemImage');
Object.defineProperty(exports, 'ItemImage', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_ItemImage).default;
}
});
var _ItemMeta = require('./views/Item/ItemMeta');
Object.defineProperty(exports, 'ItemMeta', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_ItemMeta).default;
}
});
var _Statistic = require('./views/Statistic');
Object.defineProperty(exports, 'Statistic', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_Statistic).default;
}
});
var _StatisticGroup = require('./views/Statistic/StatisticGroup');
Object.defineProperty(exports, 'StatisticGroup', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_StatisticGroup).default;
}
});
var _StatisticLabel = require('./views/Statistic/StatisticLabel');
Object.defineProperty(exports, 'StatisticLabel', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_StatisticLabel).default;
}
});
var _StatisticValue = require('./views/Statistic/StatisticValue');
Object.defineProperty(exports, 'StatisticValue', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_StatisticValue).default;
}
});
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
| File | Statements | Branches | Functions | Lines | |||||
|---|---|---|---|---|---|---|---|---|---|
| Confirm.js | 65.45% | (36 / 55) | 50% | (5 / 10) | 22.22% | (2 / 9) | 66.04% | (35 / 53) | |
| index.js | 100% | (7 / 7) | 75% | (3 / 4) | 100% | (1 / 1) | 100% | (6 / 6) |
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 | 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 11 1 1 1 1 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
var _createClass2 = require('babel-runtime/helpers/createClass');
var _createClass3 = _interopRequireDefault(_createClass2);
var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
var _inherits2 = require('babel-runtime/helpers/inherits');
var _inherits3 = _interopRequireDefault(_inherits2);
var _has2 = require('lodash/has');
var _has3 = _interopRequireDefault(_has2);
var _invoke2 = require('lodash/invoke');
var _invoke3 = _interopRequireDefault(_invoke2);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
var _Button = require('../../elements/Button');
var _Button2 = _interopRequireDefault(_Button);
var _Modal = require('../../modules/Modal');
var _Modal2 = _interopRequireDefault(_Modal);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* A Confirm modal gives the user a choice to confirm or cancel an action/
* @see Modal
*/
var Confirm = function (_Component) {
(0, _inherits3.default)(Confirm, _Component);
function Confirm() {
var _ref;
var _temp, _this, _ret;
(0, _classCallCheck3.default)(this, Confirm);
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return _ret = (_temp = (_this = (0, _possibleConstructorReturn3.default)(this, (_ref = Confirm.__proto__ || Object.getPrototypeOf(Confirm)).call.apply(_ref, [this].concat(args))), _this), _this.handleCancel = function (e) {
(0, _invoke3.default)(_this.props, 'onCancel', e, _this.props);
}, _this.handleCancelOverrides = function (predefinedProps) {
return {
onClick: function onClick(e, buttonProps) {
(0, _invoke3.default)(predefinedProps, 'onClick', e, buttonProps);
_this.handleCancel(e);
}
};
}, _this.handleConfirmOverrides = function (predefinedProps) {
return {
onClick: function onClick(e, buttonProps) {
(0, _invoke3.default)(predefinedProps, 'onClick', e, buttonProps);
(0, _invoke3.default)(_this.props, 'onConfirm', e, _this.props);
}
};
}, _temp), (0, _possibleConstructorReturn3.default)(_this, _ret);
}
(0, _createClass3.default)(Confirm, [{
key: 'render',
value: function render() {
var _props = this.props,
cancelButton = _props.cancelButton,
confirmButton = _props.confirmButton,
content = _props.content,
header = _props.header,
open = _props.open;
var rest = (0, _lib.getUnhandledProps)(Confirm, this.props);
// `open` is auto controlled by the Modal
// It cannot be present (even undefined) with `defaultOpen`
// only apply it if the user provided an open prop
var openProp = {};
if ((0, _has3.default)(this.props, 'open')) openProp.open = open;
return _react2.default.createElement(
_Modal2.default,
(0, _extends3.default)({}, rest, openProp, { size: 'small', onClose: this.handleCancel }),
_Modal2.default.Header.create(header),
_Modal2.default.Content.create(content),
_react2.default.createElement(
_Modal2.default.Actions,
null,
_Button2.default.create(cancelButton, { overrideProps: this.handleCancelOverrides }),
_Button2.default.create(confirmButton, {
defaultProps: { primary: true },
overrideProps: this.handleConfirmOverrides
})
)
);
}
}]);
return Confirm;
}(_react.Component);
Confirm.defaultProps = {
cancelButton: 'Cancel',
confirmButton: 'OK',
content: 'Are you sure?'
};
Confirm._meta = {
name: 'Confirm',
type: _lib.META.TYPES.ADDON
};
process.env.NODE_ENV !== "production" ? Confirm.propTypes = {
/** The cancel button text. */
cancelButton: _lib.customPropTypes.itemShorthand,
/** The OK button text. */
confirmButton: _lib.customPropTypes.itemShorthand,
/** The ModalContent text. */
content: _lib.customPropTypes.itemShorthand,
/** The ModalHeader text. */
header: _lib.customPropTypes.itemShorthand,
/**
* Called when the Modal is closed without clicking confirm.
*
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {object} data - All props.
*/
onCancel: _propTypes2.default.func,
/**
* Called when the OK button is clicked.
*
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {object} data - All props.
*/
onConfirm: _propTypes2.default.func,
/** Whether or not the modal is visible. */
open: _propTypes2.default.bool
} : void 0;
Confirm.handledProps = ['cancelButton', 'confirmButton', 'content', 'header', 'onCancel', 'onConfirm', 'open'];
exports.default = Confirm;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = undefined;
var _Confirm = require('./Confirm');
var _Confirm2 = _interopRequireDefault(_Confirm);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = _Confirm2.default;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 | 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 8 1 1 1 1 1 1 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
var _createClass2 = require('babel-runtime/helpers/createClass');
var _createClass3 = _interopRequireDefault(_createClass2);
var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
var _inherits2 = require('babel-runtime/helpers/inherits');
var _inherits3 = _interopRequireDefault(_inherits2);
var _invoke2 = require('lodash/invoke');
var _invoke3 = _interopRequireDefault(_invoke2);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _reactDom = require('react-dom');
var _reactDom2 = _interopRequireDefault(_reactDom);
var _lib = require('../../lib');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var debug = (0, _lib.makeDebugger)('portal');
/**
* A component that allows you to render children outside their parent.
* @see Modal
* @see Popup
* @see Dimmer
* @see Confirm
*/
var Portal = function (_Component) {
(0, _inherits3.default)(Portal, _Component);
function Portal() {
var _ref;
var _temp, _this, _ret;
(0, _classCallCheck3.default)(this, Portal);
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return _ret = (_temp = (_this = (0, _possibleConstructorReturn3.default)(this, (_ref = Portal.__proto__ || Object.getPrototypeOf(Portal)).call.apply(_ref, [this].concat(args))), _this), _this.state = {}, _this.handleDocumentClick = function (e) {
var _this$props = _this.props,
closeOnDocumentClick = _this$props.closeOnDocumentClick,
closeOnRootNodeClick = _this$props.closeOnRootNodeClick;
if (!_this.rootNode // not mounted
|| !_this.portalNode // no portal
|| (0, _invoke3.default)(_this, 'triggerNode.contains', e.target) // event happened in trigger (delegate to trigger handlers)
|| (0, _invoke3.default)(_this, 'portalNode.contains', e.target) // event happened in the portal
) return; // ignore the click
var didClickInRootNode = _this.rootNode.contains(e.target);
if (closeOnDocumentClick && !didClickInRootNode || closeOnRootNodeClick && didClickInRootNode) {
debug('handleDocumentClick()');
_this.close(e);
}
}, _this.handleEscape = function (e) {
if (!_this.props.closeOnEscape) return;
if (_lib.keyboardKey.getCode(e) !== _lib.keyboardKey.Escape) return;
debug('handleEscape()');
_this.close(e);
}, _this.handlePortalMouseLeave = function (e) {
var _this$props2 = _this.props,
closeOnPortalMouseLeave = _this$props2.closeOnPortalMouseLeave,
mouseLeaveDelay = _this$props2.mouseLeaveDelay;
if (!closeOnPortalMouseLeave) return;
debug('handlePortalMouseLeave()');
_this.mouseLeaveTimer = _this.closeWithTimeout(e, mouseLeaveDelay);
}, _this.handlePortalMouseEnter = function (e) {
// In order to enable mousing from the trigger to the portal, we need to
// clear the mouseleave timer that was set when leaving the trigger.
var closeOnPortalMouseLeave = _this.props.closeOnPortalMouseLeave;
if (!closeOnPortalMouseLeave) return;
debug('handlePortalMouseEnter()');
clearTimeout(_this.mouseLeaveTimer);
}, _this.handleTriggerBlur = function (e) {
var _this$props3 = _this.props,
trigger = _this$props3.trigger,
closeOnTriggerBlur = _this$props3.closeOnTriggerBlur;
// Call original event handler
(0, _invoke3.default)(trigger, 'props.onBlur', e);
// do not close if focus is given to the portal
var didFocusPortal = (0, _invoke3.default)(_this, 'rootNode.contains', e.relatedTarget);
if (!closeOnTriggerBlur || didFocusPortal) return;
debug('handleTriggerBlur()');
_this.close(e);
}, _this.handleTriggerClick = function (e) {
var _this$props4 = _this.props,
trigger = _this$props4.trigger,
closeOnTriggerClick = _this$props4.closeOnTriggerClick,
openOnTriggerClick = _this$props4.openOnTriggerClick;
var open = _this.state.open;
// Call original event handler
(0, _invoke3.default)(trigger, 'props.onClick', e);
if (open && closeOnTriggerClick) {
debug('handleTriggerClick() - close');
_this.close(e);
} else if (!open && openOnTriggerClick) {
debug('handleTriggerClick() - open');
_this.open(e);
}
}, _this.handleTriggerFocus = function (e) {
var _this$props5 = _this.props,
trigger = _this$props5.trigger,
openOnTriggerFocus = _this$props5.openOnTriggerFocus;
// Call original event handler
(0, _invoke3.default)(trigger, 'props.onFocus', e);
if (!openOnTriggerFocus) return;
debug('handleTriggerFocus()');
_this.open(e);
}, _this.handleTriggerMouseLeave = function (e) {
clearTimeout(_this.mouseEnterTimer);
var _this$props6 = _this.props,
trigger = _this$props6.trigger,
closeOnTriggerMouseLeave = _this$props6.closeOnTriggerMouseLeave,
mouseLeaveDelay = _this$props6.mouseLeaveDelay;
// Call original event handler
(0, _invoke3.default)(trigger, 'props.onMouseLeave', e);
if (!closeOnTriggerMouseLeave) return;
debug('handleTriggerMouseLeave()');
_this.mouseLeaveTimer = _this.closeWithTimeout(e, mouseLeaveDelay);
}, _this.handleTriggerMouseEnter = function (e) {
clearTimeout(_this.mouseLeaveTimer);
var _this$props7 = _this.props,
trigger = _this$props7.trigger,
mouseEnterDelay = _this$props7.mouseEnterDelay,
openOnTriggerMouseEnter = _this$props7.openOnTriggerMouseEnter;
// Call original event handler
(0, _invoke3.default)(trigger, 'props.onMouseEnter', _this.handleTriggerMouseEnter);
if (!openOnTriggerMouseEnter) return;
debug('handleTriggerMouseEnter()');
_this.mouseEnterTimer = _this.openWithTimeout(e, mouseEnterDelay);
}, _this.open = function (e) {
debug('open()');
var onOpen = _this.props.onOpen;
if (onOpen) onOpen(e, _this.props);
_this.trySetState({ open: true });
}, _this.openWithTimeout = function (e, delay) {
debug('openWithTimeout()', delay);
// React wipes the entire event object and suggests using e.persist() if
// you need the event for async access. However, even with e.persist
// certain required props (e.g. currentTarget) are null so we're forced to clone.
var eventClone = (0, _extends3.default)({}, e);
return setTimeout(function () {
return _this.open(eventClone);
}, delay || 0);
}, _this.close = function (e) {
debug('close()');
var onClose = _this.props.onClose;
if (onClose) onClose(e, _this.props);
_this.trySetState({ open: false });
}, _this.closeWithTimeout = function (e, delay) {
debug('closeWithTimeout()', delay);
// React wipes the entire event object and suggests using e.persist() if
// you need the event for async access. However, even with e.persist
// certain required props (e.g. currentTarget) are null so we're forced to clone.
var eventClone = (0, _extends3.default)({}, e);
return setTimeout(function () {
return _this.close(eventClone);
}, delay || 0);
}, _this.mountPortal = function () {
if (!_lib.isBrowser || _this.rootNode) return;
debug('mountPortal()');
var _this$props8 = _this.props,
_this$props8$mountNod = _this$props8.mountNode,
mountNode = _this$props8$mountNod === undefined ? _lib.isBrowser ? document.body : null : _this$props8$mountNod,
prepend = _this$props8.prepend;
_this.rootNode = document.createElement('div');
if (prepend) {
mountNode.insertBefore(_this.rootNode, mountNode.firstElementChild);
} else {
mountNode.appendChild(_this.rootNode);
}
document.addEventListener('click', _this.handleDocumentClick);
document.addEventListener('keydown', _this.handleEscape);
var onMount = _this.props.onMount;
if (onMount) onMount(null, _this.props);
}, _this.unmountPortal = function () {
if (!_lib.isBrowser || !_this.rootNode) return;
debug('unmountPortal()');
_reactDom2.default.unmountComponentAtNode(_this.rootNode);
_this.rootNode.parentNode.removeChild(_this.rootNode);
_this.portalNode.removeEventListener('mouseleave', _this.handlePortalMouseLeave);
_this.portalNode.removeEventListener('mouseenter', _this.handlePortalMouseEnter);
_this.rootNode = null;
_this.portalNode = null;
document.removeEventListener('click', _this.handleDocumentClick);
document.removeEventListener('keydown', _this.handleEscape);
var onUnmount = _this.props.onUnmount;
if (onUnmount) onUnmount(null, _this.props);
}, _this.handleRef = function (c) {
_this.triggerNode = _reactDom2.default.findDOMNode(c);
}, _temp), (0, _possibleConstructorReturn3.default)(_this, _ret);
}
(0, _createClass3.default)(Portal, [{
key: 'componentDidMount',
value: function componentDidMount() {
debug('componentDidMount()');
this.renderPortal();
}
}, {
key: 'componentDidUpdate',
value: function componentDidUpdate(prevProps, prevState) {
debug('componentDidUpdate()');
// NOTE: Ideally the portal rendering would happen in the render() function
// but React gives a warning about not being pure and suggests doing it
// within this method.
// If the portal is open, render (or re-render) the portal and child.
this.renderPortal();
if (prevState.open && !this.state.open) {
debug('portal closed');
this.unmountPortal();
}
}
}, {
key: 'componentWillUnmount',
value: function componentWillUnmount() {
this.unmountPortal();
// Clean up timers
clearTimeout(this.mouseEnterTimer);
clearTimeout(this.mouseLeaveTimer);
}
// ----------------------------------------
// Document Event Handlers
// ----------------------------------------
// ----------------------------------------
// Component Event Handlers
// ----------------------------------------
// ----------------------------------------
// Behavior
// ----------------------------------------
}, {
key: 'renderPortal',
value: function renderPortal() {
var _this2 = this;
if (!this.state.open) return;
debug('renderPortal()');
var _props = this.props,
children = _props.children,
className = _props.className;
this.mountPortal();
// Server side rendering
if (!_lib.isBrowser) return null;
this.rootNode.className = className || '';
// when re-rendering, first remove listeners before re-adding them to the new node
if (this.portalNode) {
this.portalNode.removeEventListener('mouseleave', this.handlePortalMouseLeave);
this.portalNode.removeEventListener('mouseenter', this.handlePortalMouseEnter);
}
_reactDom2.default.unstable_renderSubtreeIntoContainer(this, _react.Children.only(children), this.rootNode, function () {
_this2.portalNode = _this2.rootNode.firstElementChild;
_this2.portalNode.addEventListener('mouseleave', _this2.handlePortalMouseLeave);
_this2.portalNode.addEventListener('mouseenter', _this2.handlePortalMouseEnter);
});
}
}, {
key: 'render',
value: function render() {
var trigger = this.props.trigger;
if (!trigger) return null;
return (0, _react.cloneElement)(trigger, {
ref: this.handleRef,
onBlur: this.handleTriggerBlur,
onClick: this.handleTriggerClick,
onFocus: this.handleTriggerFocus,
onMouseLeave: this.handleTriggerMouseLeave,
onMouseEnter: this.handleTriggerMouseEnter
});
}
}]);
return Portal;
}(_lib.AutoControlledComponent);
Portal.defaultProps = {
closeOnDocumentClick: true,
closeOnEscape: true,
openOnTriggerClick: true
};
Portal.autoControlledProps = ['open'];
Portal._meta = {
name: 'Portal',
type: _lib.META.TYPES.ADDON
};
process.env.NODE_ENV !== "production" ? Portal.propTypes = {
/** Primary content. */
children: _propTypes2.default.node.isRequired,
/** Additional classes. */
className: _propTypes2.default.string,
/** Controls whether or not the portal should close when the document is clicked. */
closeOnDocumentClick: _propTypes2.default.bool,
/** Controls whether or not the portal should close when escape is pressed is displayed. */
closeOnEscape: _propTypes2.default.bool,
/**
* Controls whether or not the portal should close when mousing out of the portal.
* NOTE: This will prevent `closeOnTriggerMouseLeave` when mousing over the
* gap from the trigger to the portal.
*/
closeOnPortalMouseLeave: _propTypes2.default.bool,
/**
* Controls whether or not the portal should close on a click on the portal background.
* NOTE: This differs from closeOnDocumentClick:
* - DocumentClick - any click not within the portal
* - RootNodeClick - a click not within the portal but within the portal's wrapper
*/
closeOnRootNodeClick: _propTypes2.default.bool,
/** Controls whether or not the portal should close on blur of the trigger. */
closeOnTriggerBlur: _propTypes2.default.bool,
/** Controls whether or not the portal should close on click of the trigger. */
closeOnTriggerClick: _propTypes2.default.bool,
/** Controls whether or not the portal should close when mousing out of the trigger. */
closeOnTriggerMouseLeave: _propTypes2.default.bool,
/** Initial value of open. */
defaultOpen: _propTypes2.default.bool,
/** The node where the portal should mount. */
mountNode: _propTypes2.default.any,
/** Milliseconds to wait before closing on mouse leave */
mouseLeaveDelay: _propTypes2.default.number,
/** Milliseconds to wait before opening on mouse over */
mouseEnterDelay: _propTypes2.default.number,
/**
* Called when a close event happens
*
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {object} data - All props.
*/
onClose: _propTypes2.default.func,
/**
* Called when the portal is mounted on the DOM
*
* @param {null}
* @param {object} data - All props.
*/
onMount: _propTypes2.default.func,
/**
* Called when an open event happens
*
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {object} data - All props.
*/
onOpen: _propTypes2.default.func,
/**
* Called when the portal is unmounted from the DOM
*
* @param {null}
* @param {object} data - All props.
*/
onUnmount: _propTypes2.default.func,
/** Controls whether or not the portal is displayed. */
open: _propTypes2.default.bool,
/** Controls whether or not the portal should open when the trigger is clicked. */
openOnTriggerClick: _propTypes2.default.bool,
/** Controls whether or not the portal should open on focus of the trigger. */
openOnTriggerFocus: _propTypes2.default.bool,
/** Controls whether or not the portal should open when mousing over the trigger. */
openOnTriggerMouseEnter: _propTypes2.default.bool,
/** Controls whether the portal should be prepended to the mountNode instead of appended. */
prepend: _propTypes2.default.bool,
/** Element to be rendered in-place where the portal is defined. */
trigger: _propTypes2.default.node
} : void 0;
Portal.handledProps = ['children', 'className', 'closeOnDocumentClick', 'closeOnEscape', 'closeOnPortalMouseLeave', 'closeOnRootNodeClick', 'closeOnTriggerBlur', 'closeOnTriggerClick', 'closeOnTriggerMouseLeave', 'defaultOpen', 'mountNode', 'mouseEnterDelay', 'mouseLeaveDelay', 'onClose', 'onMount', 'onOpen', 'onUnmount', 'open', 'openOnTriggerClick', 'openOnTriggerFocus', 'openOnTriggerMouseEnter', 'prepend', 'trigger'];
exports.default = Portal;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = undefined;
var _Portal = require('./Portal');
var _Portal2 = _interopRequireDefault(_Portal);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = _Portal2.default;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | 1 1 1 1 1 1 1 1 3 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
var _Checkbox = require('../../modules/Checkbox');
var _Checkbox2 = _interopRequireDefault(_Checkbox);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* A Radio is sugar for <Checkbox radio />.
* Useful for exclusive groups of sliders or toggles.
* @see Checkbox
* @see Form
*/
function Radio(props) {
var slider = props.slider,
toggle = props.toggle,
type = props.type;
var rest = (0, _lib.getUnhandledProps)(Radio, props);
// const ElementType = getElementType(Radio, props)
// radio, slider, toggle are exclusive
// use an undefined radio if slider or toggle are present
var radio = !(slider || toggle) || undefined;
return _react2.default.createElement(_Checkbox2.default, (0, _extends3.default)({}, rest, { type: type, radio: radio, slider: slider, toggle: toggle }));
}
Radio.handledProps = ['slider', 'toggle', 'type'];
Radio._meta = {
name: 'Radio',
type: _lib.META.TYPES.ADDON
};
process.env.NODE_ENV !== "production" ? Radio.propTypes = {
/** Format to emphasize the current selection state. */
slider: _Checkbox2.default.propTypes.slider,
/** Format to show an on or off choice. */
toggle: _Checkbox2.default.propTypes.toggle,
/** HTML input type, either checkbox or radio. */
type: _Checkbox2.default.propTypes.type
} : void 0;
Radio.defaultProps = {
type: 'radio'
};
exports.default = Radio;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = undefined;
var _Radio = require('./Radio');
var _Radio2 = _interopRequireDefault(_Radio);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = _Radio2.default;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | 1 1 1 1 1 1 1 1 3 1 1 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
var _Dropdown = require('../../modules/Dropdown');
var _Dropdown2 = _interopRequireDefault(_Dropdown);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* A Select is sugar for <Dropdown selection />.
* @see Dropdown
* @see Form
*/
function Select(props) {
return _react2.default.createElement(_Dropdown2.default, (0, _extends3.default)({}, props, { selection: true }));
}
Select.handledProps = [];
Select._meta = {
name: 'Select',
type: _lib.META.TYPES.ADDON
};
Select.Divider = _Dropdown2.default.Divider;
Select.Header = _Dropdown2.default.Header;
Select.Item = _Dropdown2.default.Item;
Select.Menu = _Dropdown2.default.Menu;
exports.default = Select;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = undefined;
var _Select = require('./Select');
var _Select2 = _interopRequireDefault(_Select);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = _Select2.default;
|
| File | Statements | Branches | Functions | Lines | |||||
|---|---|---|---|---|---|---|---|---|---|
| TextArea.js | 43.08% | (28 / 65) | 20% | (5 / 25) | 20% | (2 / 10) | 44.26% | (27 / 61) | |
| index.js | 100% | (7 / 7) | 75% | (3 / 4) | 100% | (1 / 1) | 100% | (6 / 6) |
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 | 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 7 1 1 1 1 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
var _createClass2 = require('babel-runtime/helpers/createClass');
var _createClass3 = _interopRequireDefault(_createClass2);
var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
var _inherits2 = require('babel-runtime/helpers/inherits');
var _inherits3 = _interopRequireDefault(_inherits2);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* A TextArea can be used to allow for extended user input.
* @see Form
*/
var TextArea = function (_Component) {
(0, _inherits3.default)(TextArea, _Component);
function TextArea() {
var _ref;
var _temp, _this, _ret;
(0, _classCallCheck3.default)(this, TextArea);
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return _ret = (_temp = (_this = (0, _possibleConstructorReturn3.default)(this, (_ref = TextArea.__proto__ || Object.getPrototypeOf(TextArea)).call.apply(_ref, [this].concat(args))), _this), _this.handleChange = function (e) {
var onChange = _this.props.onChange;
if (onChange) onChange(e, (0, _extends3.default)({}, _this.props, { value: e.target && e.target.value }));
_this.updateHeight(e.target);
}, _this.handleRef = function (c) {
return _this.ref = c;
}, _this.removeAutoHeightStyles = function () {
_this.ref.removeAttribute('rows');
_this.ref.style.height = null;
_this.ref.style.minHeight = null;
_this.ref.style.resize = null;
}, _this.updateHeight = function () {
if (!_this.ref) return;
var autoHeight = _this.props.autoHeight;
if (!autoHeight) return;
var _window$getComputedSt = window.getComputedStyle(_this.ref),
borderTopWidth = _window$getComputedSt.borderTopWidth,
borderBottomWidth = _window$getComputedSt.borderBottomWidth;
borderTopWidth = parseInt(borderTopWidth, 10);
borderBottomWidth = parseInt(borderBottomWidth, 10);
_this.ref.rows = '1';
_this.ref.style.minHeight = '0';
_this.ref.style.resize = 'none';
_this.ref.style.height = 'auto';
_this.ref.style.height = _this.ref.scrollHeight + borderTopWidth + borderBottomWidth + 'px';
}, _temp), (0, _possibleConstructorReturn3.default)(_this, _ret);
}
(0, _createClass3.default)(TextArea, [{
key: 'componentDidMount',
value: function componentDidMount() {
this.updateHeight();
}
}, {
key: 'componentDidUpdate',
value: function componentDidUpdate(prevProps, prevState) {
// removed autoHeight
if (!this.props.autoHeight && prevProps.autoHeight) {
this.removeAutoHeightStyles();
}
// added autoHeight or value changed
if (this.props.autoHeight && !prevProps.autoHeight || prevProps.value !== this.props.value) {
this.updateHeight();
}
}
}, {
key: 'render',
value: function render() {
var value = this.props.value;
var rest = (0, _lib.getUnhandledProps)(TextArea, this.props);
var ElementType = (0, _lib.getElementType)(TextArea, this.props);
return _react2.default.createElement(ElementType, (0, _extends3.default)({}, rest, { onChange: this.handleChange, ref: this.handleRef, value: value }));
}
}]);
return TextArea;
}(_react.Component);
TextArea._meta = {
name: 'TextArea',
type: _lib.META.TYPES.ADDON
};
TextArea.defaultProps = {
as: 'textarea'
};
process.env.NODE_ENV !== "production" ? TextArea.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Indicates whether height of the textarea fits the content or not. */
autoHeight: _propTypes2.default.bool,
/**
* Called on change.
* @param {SyntheticEvent} event - The React SyntheticEvent object
* @param {object} data - All props and the event value.
*/
onChange: _propTypes2.default.func,
/** The value of the textarea. */
value: _propTypes2.default.string
} : void 0;
TextArea.handledProps = ['as', 'autoHeight', 'onChange', 'value'];
exports.default = TextArea;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = undefined;
var _TextArea = require('./TextArea');
var _TextArea2 = _interopRequireDefault(_TextArea);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = _TextArea2.default;
|
| File | Statements | Branches | Functions | Lines | |||||
|---|---|---|---|---|---|---|---|---|---|
| Breadcrumb.js | 67.44% | (29 / 43) | 41.67% | (5 / 12) | 33.33% | (1 / 3) | 68.29% | (28 / 41) | |
| BreadcrumbDivider.js | 68.75% | (22 / 32) | 41.67% | (5 / 12) | 33.33% | (1 / 3) | 72.41% | (21 / 29) | |
| BreadcrumbSection.js | 65.31% | (32 / 49) | 31.25% | (5 / 16) | 28.57% | (2 / 7) | 67.39% | (31 / 46) | |
| index.js | 100% | (7 / 7) | 75% | (3 / 4) | 100% | (1 / 1) | 100% | (6 / 6) |
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 | 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 9 1 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _without2 = require('lodash/without');
var _without3 = _interopRequireDefault(_without2);
var _each2 = require('lodash/each');
var _each3 = _interopRequireDefault(_each2);
var _isNil2 = require('lodash/isNil');
var _isNil3 = _interopRequireDefault(_isNil2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
var _BreadcrumbDivider = require('./BreadcrumbDivider');
var _BreadcrumbDivider2 = _interopRequireDefault(_BreadcrumbDivider);
var _BreadcrumbSection = require('./BreadcrumbSection');
var _BreadcrumbSection2 = _interopRequireDefault(_BreadcrumbSection);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* A breadcrumb is used to show hierarchy between content.
*/
function Breadcrumb(props) {
var children = props.children,
className = props.className,
divider = props.divider,
icon = props.icon,
sections = props.sections,
size = props.size;
var classes = (0, _classnames2.default)('ui', size, 'breadcrumb', className);
var rest = (0, _lib.getUnhandledProps)(Breadcrumb, props);
var ElementType = (0, _lib.getElementType)(Breadcrumb, props);
if (!(0, _isNil3.default)(children)) return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
children
);
var childElements = [];
(0, _each3.default)(sections, function (section, index) {
// section
var breadcrumbElement = _BreadcrumbSection2.default.create(section);
childElements.push(breadcrumbElement);
// divider
if (index !== sections.length - 1) {
var key = breadcrumbElement.key + '_divider' || JSON.stringify(section);
childElements.push(_BreadcrumbDivider2.default.create({ content: divider, icon: icon, key: key }));
}
});
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
childElements
);
}
Breadcrumb.handledProps = ['as', 'children', 'className', 'divider', 'icon', 'sections', 'size'];
Breadcrumb._meta = {
name: 'Breadcrumb',
type: _lib.META.TYPES.COLLECTION
};
process.env.NODE_ENV !== "production" ? Breadcrumb.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string,
/** Shorthand for primary content of the Breadcrumb.Divider. */
divider: _lib.customPropTypes.every([_lib.customPropTypes.disallow(['icon']), _lib.customPropTypes.contentShorthand]),
/** For use with the sections prop. Render as an `Icon` component with `divider` class instead of a `div` in
* Breadcrumb.Divider. */
icon: _lib.customPropTypes.every([_lib.customPropTypes.disallow(['divider']), _lib.customPropTypes.itemShorthand]),
/** Shorthand array of props for Breadcrumb.Section. */
sections: _lib.customPropTypes.collectionShorthand,
/** Size of Breadcrumb. */
size: _propTypes2.default.oneOf((0, _without3.default)(_lib.SUI.SIZES, 'medium'))
} : void 0;
Breadcrumb.Divider = _BreadcrumbDivider2.default;
Breadcrumb.Section = _BreadcrumbSection2.default;
exports.default = Breadcrumb;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | 1 1 1 1 1 1 1 1 1 1 1 1 1 1 6 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _isNil2 = require('lodash/isNil');
var _isNil3 = _interopRequireDefault(_isNil2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
var _Icon = require('../../elements/Icon');
var _Icon2 = _interopRequireDefault(_Icon);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* A divider sub-component for Breadcrumb component.
*/
function BreadcrumbDivider(props) {
var children = props.children,
className = props.className,
content = props.content,
icon = props.icon;
var classes = (0, _classnames2.default)('divider', className);
var rest = (0, _lib.getUnhandledProps)(BreadcrumbDivider, props);
var ElementType = (0, _lib.getElementType)(BreadcrumbDivider, props);
if (!(0, _isNil3.default)(icon)) return _Icon2.default.create(icon, { defaultProps: (0, _extends3.default)({}, rest, { className: classes }) });
if (!(0, _isNil3.default)(content)) return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
content
);
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
(0, _isNil3.default)(children) ? '/' : children
);
}
BreadcrumbDivider.handledProps = ['as', 'children', 'className', 'content', 'icon'];
BreadcrumbDivider._meta = {
name: 'BreadcrumbDivider',
type: _lib.META.TYPES.COLLECTION,
parent: 'Breadcrumb'
};
process.env.NODE_ENV !== "production" ? BreadcrumbDivider.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string,
/** Shorthand for primary content. */
content: _lib.customPropTypes.contentShorthand,
/** Render as an `Icon` component with `divider` class instead of a `div`. */
icon: _lib.customPropTypes.itemShorthand
} : void 0;
BreadcrumbDivider.create = (0, _lib.createShorthandFactory)(BreadcrumbDivider, function (icon) {
return { icon: icon };
});
exports.default = BreadcrumbDivider;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 | 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 9 1 1 1 1 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
var _createClass2 = require('babel-runtime/helpers/createClass');
var _createClass3 = _interopRequireDefault(_createClass2);
var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
var _inherits2 = require('babel-runtime/helpers/inherits');
var _inherits3 = _interopRequireDefault(_inherits2);
var _isNil2 = require('lodash/isNil');
var _isNil3 = _interopRequireDefault(_isNil2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* A section sub-component for Breadcrumb component.
*/
var BreadcrumbSection = function (_Component) {
(0, _inherits3.default)(BreadcrumbSection, _Component);
function BreadcrumbSection() {
var _ref;
var _temp, _this, _ret;
(0, _classCallCheck3.default)(this, BreadcrumbSection);
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return _ret = (_temp = (_this = (0, _possibleConstructorReturn3.default)(this, (_ref = BreadcrumbSection.__proto__ || Object.getPrototypeOf(BreadcrumbSection)).call.apply(_ref, [this].concat(args))), _this), _this.handleClick = function (e) {
var onClick = _this.props.onClick;
if (onClick) onClick(e, _this.props);
}, _temp), (0, _possibleConstructorReturn3.default)(_this, _ret);
}
(0, _createClass3.default)(BreadcrumbSection, [{
key: 'render',
value: function render() {
var _props = this.props,
active = _props.active,
children = _props.children,
className = _props.className,
content = _props.content,
href = _props.href,
link = _props.link,
onClick = _props.onClick;
var classes = (0, _classnames2.default)((0, _lib.useKeyOnly)(active, 'active'), 'section', className);
var rest = (0, _lib.getUnhandledProps)(BreadcrumbSection, this.props);
var ElementType = (0, _lib.getElementType)(BreadcrumbSection, this.props, function () {
if (link || onClick) return 'a';
});
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes, href: href, onClick: this.handleClick }),
(0, _isNil3.default)(children) ? content : children
);
}
}]);
return BreadcrumbSection;
}(_react.Component);
BreadcrumbSection._meta = {
name: 'BreadcrumbSection',
type: _lib.META.TYPES.COLLECTION,
parent: 'Breadcrumb'
};
exports.default = BreadcrumbSection;
process.env.NODE_ENV !== "production" ? BreadcrumbSection.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Style as the currently active section. */
active: _propTypes2.default.bool,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string,
/** Shorthand for primary content. */
content: _lib.customPropTypes.contentShorthand,
/** Render as an `a` tag instead of a `div` and adds the href attribute. */
href: _lib.customPropTypes.every([_lib.customPropTypes.disallow(['link']), _propTypes2.default.string]),
/** Render as an `a` tag instead of a `div`. */
link: _lib.customPropTypes.every([_lib.customPropTypes.disallow(['href']), _propTypes2.default.bool]),
/**
* Called on click. When passed, the component will render as an `a`
* tag by default instead of a `div`.
*
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {object} data - All props.
*/
onClick: _propTypes2.default.func
} : void 0;
BreadcrumbSection.handledProps = ['active', 'as', 'children', 'className', 'content', 'href', 'link', 'onClick'];
BreadcrumbSection.create = (0, _lib.createShorthandFactory)(BreadcrumbSection, function (content) {
return { content: content, link: true };
});
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = undefined;
var _Breadcrumb = require('./Breadcrumb');
var _Breadcrumb2 = _interopRequireDefault(_Breadcrumb);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = _Breadcrumb2.default;
|
| File | Statements | Branches | Functions | Lines | |||||
|---|---|---|---|---|---|---|---|---|---|
| Form.js | 90.38% | (47 / 52) | 83.33% | (5 / 6) | 50% | (1 / 2) | 90.2% | (46 / 51) | |
| FormButton.js | 81.82% | (18 / 22) | 83.33% | (5 / 6) | 50% | (1 / 2) | 80.95% | (17 / 21) | |
| FormCheckbox.js | 81.82% | (18 / 22) | 83.33% | (5 / 6) | 50% | (1 / 2) | 80.95% | (17 / 21) | |
| FormDropdown.js | 81.82% | (18 / 22) | 83.33% | (5 / 6) | 50% | (1 / 2) | 80.95% | (17 / 21) | |
| FormField.js | 62.16% | (23 / 37) | 26.32% | (5 / 19) | 50% | (1 / 2) | 62.86% | (22 / 35) | |
| FormGroup.js | 79.17% | (19 / 24) | 83.33% | (5 / 6) | 50% | (1 / 2) | 78.26% | (18 / 23) | |
| FormInput.js | 81.82% | (18 / 22) | 83.33% | (5 / 6) | 50% | (1 / 2) | 80.95% | (17 / 21) | |
| FormRadio.js | 81.82% | (18 / 22) | 83.33% | (5 / 6) | 50% | (1 / 2) | 80.95% | (17 / 21) | |
| FormSelect.js | 81.82% | (18 / 22) | 83.33% | (5 / 6) | 50% | (1 / 2) | 80.95% | (17 / 21) | |
| FormTextArea.js | 81.82% | (18 / 22) | 83.33% | (5 / 6) | 50% | (1 / 2) | 80.95% | (17 / 21) | |
| index.js | 100% | (7 / 7) | 75% | (3 / 4) | 100% | (1 / 1) | 100% | (6 / 6) |
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 | 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 14 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _without2 = require('lodash/without');
var _without3 = _interopRequireDefault(_without2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
var _FormButton = require('./FormButton');
var _FormButton2 = _interopRequireDefault(_FormButton);
var _FormCheckbox = require('./FormCheckbox');
var _FormCheckbox2 = _interopRequireDefault(_FormCheckbox);
var _FormDropdown = require('./FormDropdown');
var _FormDropdown2 = _interopRequireDefault(_FormDropdown);
var _FormField = require('./FormField');
var _FormField2 = _interopRequireDefault(_FormField);
var _FormGroup = require('./FormGroup');
var _FormGroup2 = _interopRequireDefault(_FormGroup);
var _FormInput = require('./FormInput');
var _FormInput2 = _interopRequireDefault(_FormInput);
var _FormRadio = require('./FormRadio');
var _FormRadio2 = _interopRequireDefault(_FormRadio);
var _FormSelect = require('./FormSelect');
var _FormSelect2 = _interopRequireDefault(_FormSelect);
var _FormTextArea = require('./FormTextArea');
var _FormTextArea2 = _interopRequireDefault(_FormTextArea);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* A Form displays a set of related user input fields in a structured way.
* @see Button
* @see Checkbox
* @see Dropdown
* @see Input
* @see Message
* @see Radio
* @see Select
* @see TextArea
*/
function Form(props) {
var children = props.children,
className = props.className,
error = props.error,
inverted = props.inverted,
loading = props.loading,
reply = props.reply,
size = props.size,
success = props.success,
warning = props.warning,
widths = props.widths;
var classes = (0, _classnames2.default)('ui', size, (0, _lib.useKeyOnly)(error, 'error'), (0, _lib.useKeyOnly)(inverted, 'inverted'), (0, _lib.useKeyOnly)(loading, 'loading'), (0, _lib.useKeyOnly)(reply, 'reply'), (0, _lib.useKeyOnly)(success, 'success'), (0, _lib.useKeyOnly)(warning, 'warning'), (0, _lib.useWidthProp)(widths, null, true), 'form', className);
var rest = (0, _lib.getUnhandledProps)(Form, props);
var ElementType = (0, _lib.getElementType)(Form, props);
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
children
);
}
Form.handledProps = ['as', 'children', 'className', 'error', 'inverted', 'loading', 'reply', 'size', 'success', 'warning', 'widths'];
process.env.NODE_ENV !== "production" ? Form.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string,
/** Automatically show any error Message children. */
error: _propTypes2.default.bool,
/** A form can have its color inverted for contrast. */
inverted: _propTypes2.default.bool,
/** Automatically show a loading indicator. */
loading: _propTypes2.default.bool,
/** A comment can contain a form to reply to a comment. This may have arbitrary content. */
reply: _propTypes2.default.bool,
/** A form can vary in size. */
size: _propTypes2.default.oneOf((0, _without3.default)(_lib.SUI.SIZES, 'medium')),
/** Automatically show any success Message children. */
success: _propTypes2.default.bool,
/** Automatically show any warning Message children .*/
warning: _propTypes2.default.bool,
/** Forms can automatically divide fields to be equal width. */
widths: _propTypes2.default.oneOf(['equal'])
} : void 0;
Form.defaultProps = {
as: 'form'
};
Form._meta = {
name: 'Form',
type: _lib.META.TYPES.COLLECTION
};
Form.Field = _FormField2.default;
Form.Button = _FormButton2.default;
Form.Checkbox = _FormCheckbox2.default;
Form.Dropdown = _FormDropdown2.default;
Form.Group = _FormGroup2.default;
Form.Input = _FormInput2.default;
Form.Radio = _FormRadio2.default;
Form.Select = _FormSelect2.default;
Form.TextArea = _FormTextArea2.default;
exports.default = Form;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | 1 1 1 1 1 1 1 1 1 1 4 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
var _Button = require('../../elements/Button');
var _Button2 = _interopRequireDefault(_Button);
var _FormField = require('./FormField');
var _FormField2 = _interopRequireDefault(_FormField);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* Sugar for <Form.Field control={Button} />.
* @see Button
* @see Form
*/
function FormButton(props) {
var control = props.control;
var rest = (0, _lib.getUnhandledProps)(FormButton, props);
var ElementType = (0, _lib.getElementType)(FormButton, props);
return _react2.default.createElement(ElementType, (0, _extends3.default)({}, rest, { control: control }));
}
FormButton.handledProps = ['as', 'control'];
FormButton._meta = {
name: 'FormButton',
parent: 'Form',
type: _lib.META.TYPES.COLLECTION
};
process.env.NODE_ENV !== "production" ? FormButton.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** A FormField control prop. */
control: _FormField2.default.propTypes.control
} : void 0;
FormButton.defaultProps = {
as: _FormField2.default,
control: _Button2.default
};
exports.default = FormButton;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | 1 1 1 1 1 1 1 1 1 1 4 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
var _Checkbox = require('../../modules/Checkbox');
var _Checkbox2 = _interopRequireDefault(_Checkbox);
var _FormField = require('./FormField');
var _FormField2 = _interopRequireDefault(_FormField);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* Sugar for <Form.Field control={Checkbox} />.
* @see Checkbox
* @see Form
*/
function FormCheckbox(props) {
var control = props.control;
var rest = (0, _lib.getUnhandledProps)(FormCheckbox, props);
var ElementType = (0, _lib.getElementType)(FormCheckbox, props);
return _react2.default.createElement(ElementType, (0, _extends3.default)({}, rest, { control: control }));
}
FormCheckbox.handledProps = ['as', 'control'];
FormCheckbox._meta = {
name: 'FormCheckbox',
parent: 'Form',
type: _lib.META.TYPES.COLLECTION
};
process.env.NODE_ENV !== "production" ? FormCheckbox.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** A FormField control prop. */
control: _FormField2.default.propTypes.control
} : void 0;
FormCheckbox.defaultProps = {
as: _FormField2.default,
control: _Checkbox2.default
};
exports.default = FormCheckbox;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | 1 1 1 1 1 1 1 1 1 1 4 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
var _Dropdown = require('../../modules/Dropdown');
var _Dropdown2 = _interopRequireDefault(_Dropdown);
var _FormField = require('./FormField');
var _FormField2 = _interopRequireDefault(_FormField);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* Sugar for <Form.Field control={Dropdown} />.
* @see Dropdown
* @see Form
*/
function FormDropdown(props) {
var control = props.control;
var rest = (0, _lib.getUnhandledProps)(FormDropdown, props);
var ElementType = (0, _lib.getElementType)(FormDropdown, props);
return _react2.default.createElement(ElementType, (0, _extends3.default)({}, rest, { control: control }));
}
FormDropdown.handledProps = ['as', 'control'];
FormDropdown._meta = {
name: 'FormDropdown',
parent: 'Form',
type: _lib.META.TYPES.COLLECTION
};
process.env.NODE_ENV !== "production" ? FormDropdown.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** A FormField control prop. */
control: _FormField2.default.propTypes.control
} : void 0;
FormDropdown.defaultProps = {
as: _FormField2.default,
control: _Dropdown2.default
};
exports.default = FormDropdown;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 | 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 7 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _isNil2 = require('lodash/isNil');
var _isNil3 = _interopRequireDefault(_isNil2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
var _Checkbox = require('../../modules/Checkbox');
var _Checkbox2 = _interopRequireDefault(_Checkbox);
var _Radio = require('../../addons/Radio');
var _Radio2 = _interopRequireDefault(_Radio);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* A field is a form element containing a label and an input.
* @see Form
* @see Button
* @see Checkbox
* @see Dropdown
* @see Input
* @see Radio
* @see Select
* @see TextArea
*/
function FormField(props) {
var children = props.children,
className = props.className,
control = props.control,
disabled = props.disabled,
error = props.error,
inline = props.inline,
label = props.label,
required = props.required,
type = props.type,
width = props.width;
var classes = (0, _classnames2.default)((0, _lib.useKeyOnly)(disabled, 'disabled'), (0, _lib.useKeyOnly)(error, 'error'), (0, _lib.useKeyOnly)(inline, 'inline'), (0, _lib.useKeyOnly)(required, 'required'), (0, _lib.useWidthProp)(width, 'wide'), 'field', className);
var rest = (0, _lib.getUnhandledProps)(FormField, props);
var ElementType = (0, _lib.getElementType)(FormField, props);
// ----------------------------------------
// No Control
// ----------------------------------------
if ((0, _isNil3.default)(control)) {
if ((0, _isNil3.default)(label)) return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
children
);
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
(0, _lib.createHTMLLabel)(label)
);
}
// ----------------------------------------
// Checkbox/Radio Control
// ----------------------------------------
var controlProps = (0, _extends3.default)({}, rest, { children: children, required: required, type: type });
// wrap HTML checkboxes/radios in the label
if (control === 'input' && (type === 'checkbox' || type === 'radio')) {
return _react2.default.createElement(
ElementType,
{ className: classes },
_react2.default.createElement(
'label',
null,
(0, _react.createElement)(control, controlProps),
' ',
label
)
);
}
// pass label prop to controls that support it
if (control === _Checkbox2.default || control === _Radio2.default) {
return _react2.default.createElement(
ElementType,
{ className: classes },
(0, _react.createElement)(control, (0, _extends3.default)({}, controlProps, { label: label }))
);
}
// ----------------------------------------
// Other Control
// ----------------------------------------
return _react2.default.createElement(
ElementType,
{ className: classes },
(0, _lib.createHTMLLabel)(label),
(0, _react.createElement)(control, controlProps)
);
}
FormField.handledProps = ['as', 'children', 'className', 'control', 'disabled', 'error', 'inline', 'label', 'required', 'type', 'width'];
FormField._meta = {
name: 'FormField',
parent: 'Form',
type: _lib.META.TYPES.COLLECTION
};
process.env.NODE_ENV !== "production" ? FormField.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string,
/**
* A form control component (i.e. Dropdown) or HTML tagName (i.e. 'input').
* Extra FormField props are passed to the control component.
* Mutually exclusive with children.
*/
control: _lib.customPropTypes.some([_propTypes2.default.func, _propTypes2.default.oneOf(['button', 'input', 'select', 'textarea'])]),
/** Individual fields may be disabled. */
disabled: _propTypes2.default.bool,
/** Individual fields may display an error state. */
error: _propTypes2.default.bool,
/** A field can have its label next to instead of above it. */
inline: _propTypes2.default.bool,
// Heads Up!
// Do not disallow children with `label` shorthand
// The `control` might accept a `label` prop and `children`
/** Mutually exclusive with children. */
label: _propTypes2.default.oneOfType([_propTypes2.default.node, _propTypes2.default.object]),
/** A field can show that input is mandatory. */
required: _propTypes2.default.bool,
/** Passed to the control component (i.e. <input type='password' />) */
type: _lib.customPropTypes.every([_lib.customPropTypes.demand(['control'])]),
/** A field can specify its width in grid columns */
width: _propTypes2.default.oneOf(_lib.SUI.WIDTHS)
} : void 0;
exports.default = FormField;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 | 1 1 1 1 1 1 1 1 1 1 1 1 5 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _toConsumableArray2 = require('babel-runtime/helpers/toConsumableArray');
var _toConsumableArray3 = _interopRequireDefault(_toConsumableArray2);
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* A set of fields can appear grouped together.
* @see Form
*/
function FormGroup(props) {
var children = props.children,
className = props.className,
grouped = props.grouped,
inline = props.inline,
widths = props.widths;
var classes = (0, _classnames2.default)((0, _lib.useKeyOnly)(grouped, 'grouped'), (0, _lib.useKeyOnly)(inline, 'inline'), (0, _lib.useWidthProp)(widths, null, true), 'fields', className);
var rest = (0, _lib.getUnhandledProps)(FormGroup, props);
var ElementType = (0, _lib.getElementType)(FormGroup, props);
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
children
);
}
FormGroup.handledProps = ['as', 'children', 'className', 'grouped', 'inline', 'widths'];
FormGroup._meta = {
name: 'FormGroup',
parent: 'Form',
type: _lib.META.TYPES.COLLECTION
};
process.env.NODE_ENV !== "production" ? FormGroup.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string,
/** Fields can show related choices. */
grouped: _lib.customPropTypes.every([_lib.customPropTypes.disallow(['inline']), _propTypes2.default.bool]),
/** Multiple fields may be inline in a row. */
inline: _lib.customPropTypes.every([_lib.customPropTypes.disallow(['grouped']), _propTypes2.default.bool]),
/** Fields Groups can specify their width in grid columns or automatically divide fields to be equal width. */
widths: _propTypes2.default.oneOf([].concat((0, _toConsumableArray3.default)(_lib.SUI.WIDTHS), ['equal']))
} : void 0;
exports.default = FormGroup;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | 1 1 1 1 1 1 1 1 1 1 4 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
var _Input = require('../../elements/Input');
var _Input2 = _interopRequireDefault(_Input);
var _FormField = require('./FormField');
var _FormField2 = _interopRequireDefault(_FormField);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* Sugar for <Form.Field control={Input} />.
* @see Form
* @see Input
*/
function FormInput(props) {
var control = props.control;
var rest = (0, _lib.getUnhandledProps)(FormInput, props);
var ElementType = (0, _lib.getElementType)(FormInput, props);
return _react2.default.createElement(ElementType, (0, _extends3.default)({}, rest, { control: control }));
}
FormInput.handledProps = ['as', 'control'];
FormInput._meta = {
name: 'FormInput',
parent: 'Form',
type: _lib.META.TYPES.COLLECTION
};
process.env.NODE_ENV !== "production" ? FormInput.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** A FormField control prop. */
control: _FormField2.default.propTypes.control
} : void 0;
FormInput.defaultProps = {
as: _FormField2.default,
control: _Input2.default
};
exports.default = FormInput;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | 1 1 1 1 1 1 1 1 1 1 4 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
var _Radio = require('../../addons/Radio');
var _Radio2 = _interopRequireDefault(_Radio);
var _FormField = require('./FormField');
var _FormField2 = _interopRequireDefault(_FormField);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* Sugar for <Form.Field control={Radio} />.
* @see Form
* @see Radio
*/
function FormRadio(props) {
var control = props.control;
var rest = (0, _lib.getUnhandledProps)(FormRadio, props);
var ElementType = (0, _lib.getElementType)(FormRadio, props);
return _react2.default.createElement(ElementType, (0, _extends3.default)({}, rest, { control: control }));
}
FormRadio.handledProps = ['as', 'control'];
FormRadio._meta = {
name: 'FormRadio',
parent: 'Form',
type: _lib.META.TYPES.COLLECTION
};
process.env.NODE_ENV !== "production" ? FormRadio.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** A FormField control prop. */
control: _FormField2.default.propTypes.control
} : void 0;
FormRadio.defaultProps = {
as: _FormField2.default,
control: _Radio2.default
};
exports.default = FormRadio;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | 1 1 1 1 1 1 1 1 1 1 4 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
var _Select = require('../../addons/Select');
var _Select2 = _interopRequireDefault(_Select);
var _FormField = require('./FormField');
var _FormField2 = _interopRequireDefault(_FormField);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* Sugar for <Form.Field control={Select} />.
* @see Form
* @see Select
*/
function FormSelect(props) {
var control = props.control;
var rest = (0, _lib.getUnhandledProps)(FormSelect, props);
var ElementType = (0, _lib.getElementType)(FormSelect, props);
return _react2.default.createElement(ElementType, (0, _extends3.default)({}, rest, { control: control }));
}
FormSelect.handledProps = ['as', 'control'];
FormSelect._meta = {
name: 'FormSelect',
parent: 'Form',
type: _lib.META.TYPES.COLLECTION
};
process.env.NODE_ENV !== "production" ? FormSelect.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** A FormField control prop. */
control: _FormField2.default.propTypes.control
} : void 0;
FormSelect.defaultProps = {
as: _FormField2.default,
control: _Select2.default
};
exports.default = FormSelect;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 | 1 1 1 1 1 1 1 1 1 1 4 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
var _TextArea = require('../../addons/TextArea');
var _TextArea2 = _interopRequireDefault(_TextArea);
var _FormField = require('./FormField');
var _FormField2 = _interopRequireDefault(_FormField);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* Sugar for <Form.Field control={TextArea} />.
* @see Form
* @see TextArea
*/
function FormTextArea(props) {
var control = props.control;
var rest = (0, _lib.getUnhandledProps)(FormTextArea, props);
var ElementType = (0, _lib.getElementType)(FormTextArea, props);
return _react2.default.createElement(ElementType, (0, _extends3.default)({}, rest, { control: control }));
}
FormTextArea.handledProps = ['as', 'control'];
FormTextArea._meta = {
name: 'FormTextArea',
parent: 'Form',
type: _lib.META.TYPES.COLLECTION
};
process.env.NODE_ENV !== "production" ? FormTextArea.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** A FormField control prop. */
control: _FormField2.default.propTypes.control
} : void 0;
FormTextArea.defaultProps = {
as: _FormField2.default,
control: _TextArea2.default
};
exports.default = FormTextArea;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = undefined;
var _Form = require('./Form');
var _Form2 = _interopRequireDefault(_Form);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = _Form2.default;
|
| File | Statements | Branches | Functions | Lines | |||||
|---|---|---|---|---|---|---|---|---|---|
| Grid.js | 83.33% | (25 / 30) | 83.33% | (5 / 6) | 50% | (1 / 2) | 82.76% | (24 / 29) | |
| GridColumn.js | 77.27% | (17 / 22) | 83.33% | (5 / 6) | 50% | (1 / 2) | 76.19% | (16 / 21) | |
| GridRow.js | 79.17% | (19 / 24) | 83.33% | (5 / 6) | 50% | (1 / 2) | 78.26% | (18 / 23) | |
| index.js | 100% | (7 / 7) | 75% | (3 / 4) | 100% | (1 / 1) | 100% | (6 / 6) |
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 | 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 7 1 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _toConsumableArray2 = require('babel-runtime/helpers/toConsumableArray');
var _toConsumableArray3 = _interopRequireDefault(_toConsumableArray2);
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
var _GridColumn = require('./GridColumn');
var _GridColumn2 = _interopRequireDefault(_GridColumn);
var _GridRow = require('./GridRow');
var _GridRow2 = _interopRequireDefault(_GridRow);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* A grid is used to harmonize negative space in a layout.
*/
function Grid(props) {
var celled = props.celled,
centered = props.centered,
children = props.children,
className = props.className,
columns = props.columns,
container = props.container,
divided = props.divided,
doubling = props.doubling,
padded = props.padded,
relaxed = props.relaxed,
reversed = props.reversed,
stackable = props.stackable,
stretched = props.stretched,
textAlign = props.textAlign,
verticalAlign = props.verticalAlign;
var classes = (0, _classnames2.default)('ui', (0, _lib.useKeyOnly)(centered, 'centered'), (0, _lib.useKeyOnly)(container, 'container'), (0, _lib.useKeyOnly)(doubling, 'doubling'), (0, _lib.useKeyOnly)(stackable, 'stackable'), (0, _lib.useKeyOnly)(stretched, 'stretched'), (0, _lib.useKeyOrValueAndKey)(celled, 'celled'), (0, _lib.useKeyOrValueAndKey)(divided, 'divided'), (0, _lib.useKeyOrValueAndKey)(padded, 'padded'), (0, _lib.useKeyOrValueAndKey)(relaxed, 'relaxed'), (0, _lib.useTextAlignProp)(textAlign), (0, _lib.useValueAndKey)(reversed, 'reversed'), (0, _lib.useVerticalAlignProp)(verticalAlign), (0, _lib.useWidthProp)(columns, 'column', true), 'grid', className);
var rest = (0, _lib.getUnhandledProps)(Grid, props);
var ElementType = (0, _lib.getElementType)(Grid, props);
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
children
);
}
Grid.handledProps = ['as', 'celled', 'centered', 'children', 'className', 'columns', 'container', 'divided', 'doubling', 'padded', 'relaxed', 'reversed', 'stackable', 'stretched', 'textAlign', 'verticalAlign'];
Grid.Column = _GridColumn2.default;
Grid.Row = _GridRow2.default;
Grid._meta = {
name: 'Grid',
type: _lib.META.TYPES.COLLECTION
};
process.env.NODE_ENV !== "production" ? Grid.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** A grid can have rows divided into cells. */
celled: _propTypes2.default.oneOfType([_propTypes2.default.bool, _propTypes2.default.oneOf(['internally'])]),
/** A grid can have its columns centered. */
centered: _propTypes2.default.bool,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string,
/** Represents column count per row in Grid. */
columns: _propTypes2.default.oneOf([].concat((0, _toConsumableArray3.default)(_lib.SUI.WIDTHS), ['equal'])),
/** A grid can be combined with a container to use the available layout and alignment. */
container: _propTypes2.default.bool,
/** A grid can have dividers between its columns. */
divided: _propTypes2.default.oneOfType([_propTypes2.default.bool, _propTypes2.default.oneOf(['vertically'])]),
/** A grid can double its column width on tablet and mobile sizes. */
doubling: _propTypes2.default.bool,
/** A grid can preserve its vertical and horizontal gutters on first and last columns. */
padded: _propTypes2.default.oneOfType([_propTypes2.default.bool, _propTypes2.default.oneOf(['horizontally', 'vertically'])]),
/** A grid can increase its gutters to allow for more negative space. */
relaxed: _propTypes2.default.oneOfType([_propTypes2.default.bool, _propTypes2.default.oneOf(['very'])]),
/** A grid can specify that its columns should reverse order at different device sizes. */
reversed: _propTypes2.default.oneOf(['computer', 'computer vertically', 'mobile', 'mobile vertically', 'tablet', 'tablet vertically']),
/** A grid can have its columns stack on-top of each other after reaching mobile breakpoints. */
stackable: _propTypes2.default.bool,
/** A grid can stretch its contents to take up the entire grid height. */
stretched: _propTypes2.default.bool,
/** A grid can specify its text alignment. */
textAlign: _propTypes2.default.oneOf(_lib.SUI.TEXT_ALIGNMENTS),
/** A grid can specify its vertical alignment to have all its columns vertically centered. */
verticalAlign: _propTypes2.default.oneOf(_lib.SUI.VERTICAL_ALIGNMENTS)
} : void 0;
exports.default = Grid;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | 1 1 1 1 1 1 1 1 1 1 4 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* A column sub-component for Grid.
*/
function GridColumn(props) {
var children = props.children,
className = props.className,
computer = props.computer,
color = props.color,
floated = props.floated,
largeScreen = props.largeScreen,
mobile = props.mobile,
only = props.only,
stretched = props.stretched,
tablet = props.tablet,
textAlign = props.textAlign,
verticalAlign = props.verticalAlign,
widescreen = props.widescreen,
width = props.width;
var classes = (0, _classnames2.default)(color, (0, _lib.useKeyOnly)(stretched, 'stretched'), (0, _lib.useOnlyProp)(only, 'only'), (0, _lib.useTextAlignProp)(textAlign), (0, _lib.useValueAndKey)(floated, 'floated'), (0, _lib.useVerticalAlignProp)(verticalAlign), (0, _lib.useWidthProp)(computer, 'wide computer'), (0, _lib.useWidthProp)(largeScreen, 'wide large screen'), (0, _lib.useWidthProp)(mobile, 'wide mobile'), (0, _lib.useWidthProp)(tablet, 'wide tablet'), (0, _lib.useWidthProp)(widescreen, 'wide widescreen'), (0, _lib.useWidthProp)(width, 'wide'), 'column', className);
var rest = (0, _lib.getUnhandledProps)(GridColumn, props);
var ElementType = (0, _lib.getElementType)(GridColumn, props);
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
children
);
}
GridColumn.handledProps = ['as', 'children', 'className', 'color', 'computer', 'floated', 'largeScreen', 'mobile', 'only', 'stretched', 'tablet', 'textAlign', 'verticalAlign', 'widescreen', 'width'];
GridColumn._meta = {
name: 'GridColumn',
parent: 'Grid',
type: _lib.META.TYPES.COLLECTION
};
process.env.NODE_ENV !== "production" ? GridColumn.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string,
/** A grid column can be colored. */
color: _propTypes2.default.oneOf(_lib.SUI.COLORS),
/** A column can specify a width for a computer. */
computer: _propTypes2.default.oneOf(_lib.SUI.WIDTHS),
/** A column can sit flush against the left or right edge of a row. */
floated: _propTypes2.default.oneOf(_lib.SUI.FLOATS),
/** A column can specify a width for a large screen device. */
largeScreen: _propTypes2.default.oneOf(_lib.SUI.WIDTHS),
/** A column can specify a width for a mobile device. */
mobile: _propTypes2.default.oneOf(_lib.SUI.WIDTHS),
/** A row can appear only for a specific device, or screen sizes. */
only: _lib.customPropTypes.onlyProp(_lib.SUI.VISIBILITY),
/** A column can stretch its contents to take up the entire grid or row height. */
stretched: _propTypes2.default.bool,
/** A column can specify a width for a tablet device. */
tablet: _propTypes2.default.oneOf(_lib.SUI.WIDTHS),
/** A column can specify its text alignment. */
textAlign: _propTypes2.default.oneOf(_lib.SUI.TEXT_ALIGNMENTS),
/** A column can specify its vertical alignment to have all its columns vertically centered. */
verticalAlign: _propTypes2.default.oneOf(_lib.SUI.VERTICAL_ALIGNMENTS),
/** A column can specify a width for a wide screen device. */
widescreen: _propTypes2.default.oneOf(_lib.SUI.WIDTHS),
/** Represents width of column. */
width: _propTypes2.default.oneOf(_lib.SUI.WIDTHS)
} : void 0;
exports.default = GridColumn;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 | 1 1 1 1 1 1 1 1 1 1 1 1 5 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _toConsumableArray2 = require('babel-runtime/helpers/toConsumableArray');
var _toConsumableArray3 = _interopRequireDefault(_toConsumableArray2);
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* A row sub-component for Grid.
*/
function GridRow(props) {
var centered = props.centered,
children = props.children,
className = props.className,
color = props.color,
columns = props.columns,
divided = props.divided,
only = props.only,
reversed = props.reversed,
stretched = props.stretched,
textAlign = props.textAlign,
verticalAlign = props.verticalAlign;
var classes = (0, _classnames2.default)(color, (0, _lib.useKeyOnly)(centered, 'centered'), (0, _lib.useKeyOnly)(divided, 'divided'), (0, _lib.useKeyOnly)(stretched, 'stretched'), (0, _lib.useOnlyProp)(only), (0, _lib.useTextAlignProp)(textAlign), (0, _lib.useValueAndKey)(reversed, 'reversed'), (0, _lib.useVerticalAlignProp)(verticalAlign), (0, _lib.useWidthProp)(columns, 'column', true), 'row', className);
var rest = (0, _lib.getUnhandledProps)(GridRow, props);
var ElementType = (0, _lib.getElementType)(GridRow, props);
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
children
);
}
GridRow.handledProps = ['as', 'centered', 'children', 'className', 'color', 'columns', 'divided', 'only', 'reversed', 'stretched', 'textAlign', 'verticalAlign'];
GridRow._meta = {
name: 'GridRow',
parent: 'Grid',
type: _lib.META.TYPES.COLLECTION
};
process.env.NODE_ENV !== "production" ? GridRow.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** A row can have its columns centered. */
centered: _propTypes2.default.bool,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string,
/** A grid row can be colored. */
color: _propTypes2.default.oneOf(_lib.SUI.COLORS),
/** Represents column count per line in Row. */
columns: _propTypes2.default.oneOf([].concat((0, _toConsumableArray3.default)(_lib.SUI.WIDTHS), ['equal'])),
/** A row can have dividers between its columns. */
divided: _propTypes2.default.bool,
/** A row can appear only for a specific device, or screen sizes. */
only: _lib.customPropTypes.onlyProp(_lib.SUI.VISIBILITY),
/** A row can specify that its columns should reverse order at different device sizes. */
reversed: _propTypes2.default.oneOf(['computer', 'computer vertically', 'mobile', 'mobile vertically', 'tablet', 'tablet vertically']),
/** A row can stretch its contents to take up the entire column height. */
stretched: _propTypes2.default.bool,
/** A row can specify its text alignment. */
textAlign: _propTypes2.default.oneOf(_lib.SUI.TEXT_ALIGNMENTS),
/** A row can specify its vertical alignment to have all its columns vertically centered. */
verticalAlign: _propTypes2.default.oneOf(_lib.SUI.VERTICAL_ALIGNMENTS)
} : void 0;
exports.default = GridRow;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = undefined;
var _Grid = require('./Grid');
var _Grid2 = _interopRequireDefault(_Grid);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = _Grid2.default;
|
| File | Statements | Branches | Functions | Lines | |||||
|---|---|---|---|---|---|---|---|---|---|
| Menu.js | 69.12% | (47 / 68) | 50% | (5 / 10) | 25% | (2 / 8) | 68.66% | (46 / 67) | |
| MenuHeader.js | 79.17% | (19 / 24) | 62.5% | (5 / 8) | 50% | (1 / 2) | 78.26% | (18 / 23) | |
| MenuItem.js | 65.45% | (36 / 55) | 23.81% | (5 / 21) | 28.57% | (2 / 7) | 67.31% | (35 / 52) | |
| MenuMenu.js | 77.27% | (17 / 22) | 83.33% | (5 / 6) | 50% | (1 / 2) | 76.19% | (16 / 21) | |
| index.js | 100% | (7 / 7) | 75% | (3 / 4) | 100% | (1 / 1) | 100% | (6 / 6) |
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 | 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 15 1 1 1 1 1 1 1 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
var _createClass2 = require('babel-runtime/helpers/createClass');
var _createClass3 = _interopRequireDefault(_createClass2);
var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
var _inherits2 = require('babel-runtime/helpers/inherits');
var _inherits3 = _interopRequireDefault(_inherits2);
var _isNil2 = require('lodash/isNil');
var _isNil3 = _interopRequireDefault(_isNil2);
var _map2 = require('lodash/map');
var _map3 = _interopRequireDefault(_map2);
var _invoke2 = require('lodash/invoke');
var _invoke3 = _interopRequireDefault(_invoke2);
var _without2 = require('lodash/without');
var _without3 = _interopRequireDefault(_without2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
var _MenuHeader = require('./MenuHeader');
var _MenuHeader2 = _interopRequireDefault(_MenuHeader);
var _MenuItem = require('./MenuItem');
var _MenuItem2 = _interopRequireDefault(_MenuItem);
var _MenuMenu = require('./MenuMenu');
var _MenuMenu2 = _interopRequireDefault(_MenuMenu);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* A menu displays grouped navigation actions.
* @see Dropdown
*/
var Menu = function (_Component) {
(0, _inherits3.default)(Menu, _Component);
function Menu() {
var _ref;
var _temp, _this, _ret;
(0, _classCallCheck3.default)(this, Menu);
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return _ret = (_temp = (_this = (0, _possibleConstructorReturn3.default)(this, (_ref = Menu.__proto__ || Object.getPrototypeOf(Menu)).call.apply(_ref, [this].concat(args))), _this), _this.handleItemOverrides = function (predefinedProps) {
return {
onClick: function onClick(e, itemProps) {
var index = itemProps.index;
_this.trySetState({ activeIndex: index });
(0, _invoke3.default)(predefinedProps, 'onClick', e, itemProps);
(0, _invoke3.default)(_this.props, 'onItemClick', e, itemProps);
}
};
}, _temp), (0, _possibleConstructorReturn3.default)(_this, _ret);
}
(0, _createClass3.default)(Menu, [{
key: 'renderItems',
value: function renderItems() {
var _this2 = this;
var items = this.props.items;
var activeIndex = this.state.activeIndex;
return (0, _map3.default)(items, function (item, index) {
return _MenuItem2.default.create(item, {
defaultProps: {
active: activeIndex === index,
index: index
},
overrideProps: _this2.handleItemOverrides
});
});
}
}, {
key: 'render',
value: function render() {
var _props = this.props,
attached = _props.attached,
borderless = _props.borderless,
children = _props.children,
className = _props.className,
color = _props.color,
compact = _props.compact,
fixed = _props.fixed,
floated = _props.floated,
fluid = _props.fluid,
icon = _props.icon,
inverted = _props.inverted,
pagination = _props.pagination,
pointing = _props.pointing,
secondary = _props.secondary,
size = _props.size,
stackable = _props.stackable,
tabular = _props.tabular,
text = _props.text,
vertical = _props.vertical,
widths = _props.widths;
var classes = (0, _classnames2.default)('ui', color, size, (0, _lib.useKeyOnly)(borderless, 'borderless'), (0, _lib.useKeyOnly)(compact, 'compact'), (0, _lib.useKeyOnly)(fluid, 'fluid'), (0, _lib.useKeyOnly)(inverted, 'inverted'), (0, _lib.useKeyOnly)(pagination, 'pagination'), (0, _lib.useKeyOnly)(pointing, 'pointing'), (0, _lib.useKeyOnly)(secondary, 'secondary'), (0, _lib.useKeyOnly)(stackable, 'stackable'), (0, _lib.useKeyOnly)(text, 'text'), (0, _lib.useKeyOnly)(vertical, 'vertical'), (0, _lib.useKeyOrValueAndKey)(attached, 'attached'), (0, _lib.useKeyOrValueAndKey)(floated, 'floated'), (0, _lib.useKeyOrValueAndKey)(icon, 'icon'), (0, _lib.useKeyOrValueAndKey)(tabular, 'tabular'), (0, _lib.useValueAndKey)(fixed, 'fixed'), (0, _lib.useWidthProp)(widths, 'item'), className, 'menu');
var rest = (0, _lib.getUnhandledProps)(Menu, this.props);
var ElementType = (0, _lib.getElementType)(Menu, this.props);
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
(0, _isNil3.default)(children) ? this.renderItems() : children
);
}
}]);
return Menu;
}(_lib.AutoControlledComponent);
Menu._meta = {
name: 'Menu',
type: _lib.META.TYPES.COLLECTION
};
Menu.autoControlledProps = ['activeIndex'];
Menu.Header = _MenuHeader2.default;
Menu.Item = _MenuItem2.default;
Menu.Menu = _MenuMenu2.default;
process.env.NODE_ENV !== "production" ? Menu.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Index of the currently active item. */
activeIndex: _propTypes2.default.number,
/** A menu may be attached to other content segments. */
attached: _propTypes2.default.oneOfType([_propTypes2.default.bool, _propTypes2.default.oneOf(['top', 'bottom'])]),
/** A menu item or menu can have no borders. */
borderless: _propTypes2.default.bool,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string,
/** Additional colors can be specified. */
color: _propTypes2.default.oneOf(_lib.SUI.COLORS),
/** A menu can take up only the space necessary to fit its content. */
compact: _propTypes2.default.bool,
/** Initial activeIndex value. */
defaultActiveIndex: _propTypes2.default.number,
/** A menu can be fixed to a side of its context. */
fixed: _propTypes2.default.oneOf(['left', 'right', 'bottom', 'top']),
/** A menu can be floated. */
floated: _propTypes2.default.oneOfType([_propTypes2.default.bool, _propTypes2.default.oneOf(['right'])]),
/** A vertical menu may take the size of its container. */
fluid: _propTypes2.default.bool,
/** A menu may have just icons (bool) or labeled icons. */
icon: _propTypes2.default.oneOfType([_propTypes2.default.bool, _propTypes2.default.oneOf(['labeled'])]),
/** A menu may have its colors inverted to show greater contrast. */
inverted: _propTypes2.default.bool,
/** Shorthand array of props for Menu. */
items: _lib.customPropTypes.collectionShorthand,
/**
* onClick handler for MenuItem. Mutually exclusive with children.
*
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {object} data - All item props.
*/
onItemClick: _lib.customPropTypes.every([_lib.customPropTypes.disallow(['children']), _propTypes2.default.func]),
/** A pagination menu is specially formatted to present links to pages of content. */
pagination: _propTypes2.default.bool,
/** A menu can point to show its relationship to nearby content. */
pointing: _propTypes2.default.bool,
/** A menu can adjust its appearance to de-emphasize its contents. */
secondary: _propTypes2.default.bool,
/** A menu can vary in size. */
size: _propTypes2.default.oneOf((0, _without3.default)(_lib.SUI.SIZES, 'medium', 'big')),
/** A menu can stack at mobile resolutions. */
stackable: _propTypes2.default.bool,
/** A menu can be formatted to show tabs of information. */
tabular: _propTypes2.default.oneOfType([_propTypes2.default.bool, _propTypes2.default.oneOf(['right'])]),
/** A menu can be formatted for text content. */
text: _propTypes2.default.bool,
/** A vertical menu displays elements vertically. */
vertical: _propTypes2.default.bool,
/** A menu can have its items divided evenly. */
widths: _propTypes2.default.oneOf(_lib.SUI.WIDTHS)
} : void 0;
Menu.handledProps = ['activeIndex', 'as', 'attached', 'borderless', 'children', 'className', 'color', 'compact', 'defaultActiveIndex', 'fixed', 'floated', 'fluid', 'icon', 'inverted', 'items', 'onItemClick', 'pagination', 'pointing', 'secondary', 'size', 'stackable', 'tabular', 'text', 'vertical', 'widths'];
exports.default = Menu;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | 1 1 1 1 1 1 1 1 1 1 1 1 5 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _isNil2 = require('lodash/isNil');
var _isNil3 = _interopRequireDefault(_isNil2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* A menu item may include a header or may itself be a header.
*/
function MenuHeader(props) {
var children = props.children,
className = props.className,
content = props.content;
var classes = (0, _classnames2.default)('header', className);
var rest = (0, _lib.getUnhandledProps)(MenuHeader, props);
var ElementType = (0, _lib.getElementType)(MenuHeader, props);
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
(0, _isNil3.default)(children) ? content : children
);
}
MenuHeader.handledProps = ['as', 'children', 'className', 'content'];
MenuHeader._meta = {
name: 'MenuHeader',
type: _lib.META.TYPES.COLLECTION,
parent: 'Menu'
};
process.env.NODE_ENV !== "production" ? MenuHeader.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string,
/** Shorthand for primary content. */
content: _lib.customPropTypes.contentShorthand
} : void 0;
exports.default = MenuHeader;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 | 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 11 1 1 1 1 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
var _createClass2 = require('babel-runtime/helpers/createClass');
var _createClass3 = _interopRequireDefault(_createClass2);
var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
var _inherits2 = require('babel-runtime/helpers/inherits');
var _inherits3 = _interopRequireDefault(_inherits2);
var _startCase2 = require('lodash/startCase');
var _startCase3 = _interopRequireDefault(_startCase2);
var _isNil2 = require('lodash/isNil');
var _isNil3 = _interopRequireDefault(_isNil2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
var _Icon = require('../../elements/Icon');
var _Icon2 = _interopRequireDefault(_Icon);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* A menu can contain an item.
*/
var MenuItem = function (_Component) {
(0, _inherits3.default)(MenuItem, _Component);
function MenuItem() {
var _ref;
var _temp, _this, _ret;
(0, _classCallCheck3.default)(this, MenuItem);
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return _ret = (_temp = (_this = (0, _possibleConstructorReturn3.default)(this, (_ref = MenuItem.__proto__ || Object.getPrototypeOf(MenuItem)).call.apply(_ref, [this].concat(args))), _this), _this.handleClick = function (e) {
var onClick = _this.props.onClick;
if (onClick) onClick(e, _this.props);
}, _temp), (0, _possibleConstructorReturn3.default)(_this, _ret);
}
(0, _createClass3.default)(MenuItem, [{
key: 'render',
value: function render() {
var _props = this.props,
active = _props.active,
children = _props.children,
className = _props.className,
color = _props.color,
content = _props.content,
disabled = _props.disabled,
fitted = _props.fitted,
header = _props.header,
icon = _props.icon,
link = _props.link,
name = _props.name,
onClick = _props.onClick,
position = _props.position;
var classes = (0, _classnames2.default)(color, position, (0, _lib.useKeyOnly)(active, 'active'), (0, _lib.useKeyOnly)(disabled, 'disabled'), (0, _lib.useKeyOnly)(icon === true || icon && !(name || content), 'icon'), (0, _lib.useKeyOnly)(header, 'header'), (0, _lib.useKeyOnly)(link, 'link'), (0, _lib.useKeyOrValueAndKey)(fitted, 'fitted'), 'item', className);
var ElementType = (0, _lib.getElementType)(MenuItem, this.props, function () {
if (onClick) return 'a';
});
var rest = (0, _lib.getUnhandledProps)(MenuItem, this.props);
if (!(0, _isNil3.default)(children)) {
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes, onClick: this.handleClick }),
children
);
}
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes, onClick: this.handleClick }),
_Icon2.default.create(icon),
content || (0, _startCase3.default)(name)
);
}
}]);
return MenuItem;
}(_react.Component);
MenuItem._meta = {
name: 'MenuItem',
type: _lib.META.TYPES.COLLECTION,
parent: 'Menu'
};
exports.default = MenuItem;
process.env.NODE_ENV !== "production" ? MenuItem.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** A menu item can be active. */
active: _propTypes2.default.bool,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string,
/** Additional colors can be specified. */
color: _propTypes2.default.oneOf(_lib.SUI.COLORS),
/** Shorthand for primary content. */
content: _lib.customPropTypes.contentShorthand,
/** A menu item can be disabled. */
disabled: _propTypes2.default.bool,
/** A menu item or menu can remove element padding, vertically or horizontally. */
fitted: _propTypes2.default.oneOfType([_propTypes2.default.bool, _propTypes2.default.oneOf(['horizontally', 'vertically'])]),
/** A menu item may include a header or may itself be a header. */
header: _propTypes2.default.bool,
/** MenuItem can be only icon. */
icon: _propTypes2.default.oneOfType([_propTypes2.default.bool, _lib.customPropTypes.itemShorthand]),
/** MenuItem index inside Menu. */
index: _propTypes2.default.number,
/** A menu item can be link. */
link: _propTypes2.default.bool,
/** Internal name of the MenuItem. */
name: _propTypes2.default.string,
/**
* Called on click. When passed, the component will render as an `a`
* tag by default instead of a `div`.
*
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {object} data - All props.
*/
onClick: _propTypes2.default.func,
/** A menu item can take right position. */
position: _propTypes2.default.oneOf(['right'])
} : void 0;
MenuItem.handledProps = ['active', 'as', 'children', 'className', 'color', 'content', 'disabled', 'fitted', 'header', 'icon', 'index', 'link', 'name', 'onClick', 'position'];
MenuItem.create = (0, _lib.createShorthandFactory)(MenuItem, function (val) {
return { content: val, name: val };
});
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | 1 1 1 1 1 1 1 1 1 1 4 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* A menu can contain a sub menu.
*/
function MenuMenu(props) {
var children = props.children,
className = props.className,
position = props.position;
var classes = (0, _classnames2.default)(position, 'menu', className);
var rest = (0, _lib.getUnhandledProps)(MenuMenu, props);
var ElementType = (0, _lib.getElementType)(MenuMenu, props);
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
children
);
}
MenuMenu.handledProps = ['as', 'children', 'className', 'position'];
MenuMenu._meta = {
name: 'MenuMenu',
type: _lib.META.TYPES.COLLECTION,
parent: 'Menu'
};
process.env.NODE_ENV !== "production" ? MenuMenu.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string,
/** A sub menu can take right position. */
position: _propTypes2.default.oneOf(['right'])
} : void 0;
exports.default = MenuMenu;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = undefined;
var _Menu = require('./Menu');
var _Menu2 = _interopRequireDefault(_Menu);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = _Menu2.default;
|
| File | Statements | Branches | Functions | Lines | |||||
|---|---|---|---|---|---|---|---|---|---|
| Message.js | 73.44% | (47 / 64) | 27.78% | (5 / 18) | 40% | (2 / 5) | 74.19% | (46 / 62) | |
| MessageContent.js | 77.27% | (17 / 22) | 83.33% | (5 / 6) | 50% | (1 / 2) | 76.19% | (16 / 21) | |
| MessageHeader.js | 76.92% | (20 / 26) | 62.5% | (5 / 8) | 33.33% | (1 / 3) | 76% | (19 / 25) | |
| MessageItem.js | 77.78% | (21 / 27) | 62.5% | (5 / 8) | 33.33% | (1 / 3) | 76.92% | (20 / 26) | |
| MessageList.js | 80.65% | (25 / 31) | 62.5% | (5 / 8) | 33.33% | (1 / 3) | 80% | (24 / 30) | |
| index.js | 100% | (7 / 7) | 75% | (3 / 4) | 100% | (1 / 1) | 100% | (6 / 6) |
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 | 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 15 1 1 1 1 1 1 1 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
var _createClass2 = require('babel-runtime/helpers/createClass');
var _createClass3 = _interopRequireDefault(_createClass2);
var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
var _inherits2 = require('babel-runtime/helpers/inherits');
var _inherits3 = _interopRequireDefault(_inherits2);
var _isNil2 = require('lodash/isNil');
var _isNil3 = _interopRequireDefault(_isNil2);
var _without2 = require('lodash/without');
var _without3 = _interopRequireDefault(_without2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
var _Icon = require('../../elements/Icon');
var _Icon2 = _interopRequireDefault(_Icon);
var _MessageContent = require('./MessageContent');
var _MessageContent2 = _interopRequireDefault(_MessageContent);
var _MessageHeader = require('./MessageHeader');
var _MessageHeader2 = _interopRequireDefault(_MessageHeader);
var _MessageList = require('./MessageList');
var _MessageList2 = _interopRequireDefault(_MessageList);
var _MessageItem = require('./MessageItem');
var _MessageItem2 = _interopRequireDefault(_MessageItem);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* A message displays information that explains nearby content.
* @see Form
*/
var Message = function (_Component) {
(0, _inherits3.default)(Message, _Component);
function Message() {
var _ref;
var _temp, _this, _ret;
(0, _classCallCheck3.default)(this, Message);
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return _ret = (_temp = (_this = (0, _possibleConstructorReturn3.default)(this, (_ref = Message.__proto__ || Object.getPrototypeOf(Message)).call.apply(_ref, [this].concat(args))), _this), _this.handleDismiss = function (e) {
var onDismiss = _this.props.onDismiss;
if (onDismiss) onDismiss(e, _this.props);
}, _temp), (0, _possibleConstructorReturn3.default)(_this, _ret);
}
(0, _createClass3.default)(Message, [{
key: 'render',
value: function render() {
var _props = this.props,
attached = _props.attached,
children = _props.children,
className = _props.className,
color = _props.color,
compact = _props.compact,
content = _props.content,
error = _props.error,
floating = _props.floating,
header = _props.header,
hidden = _props.hidden,
icon = _props.icon,
info = _props.info,
list = _props.list,
negative = _props.negative,
onDismiss = _props.onDismiss,
positive = _props.positive,
size = _props.size,
success = _props.success,
visible = _props.visible,
warning = _props.warning;
var classes = (0, _classnames2.default)('ui', color, size, (0, _lib.useKeyOnly)(compact, 'compact'), (0, _lib.useKeyOnly)(error, 'error'), (0, _lib.useKeyOnly)(floating, 'floating'), (0, _lib.useKeyOnly)(hidden, 'hidden'), (0, _lib.useKeyOnly)(icon, 'icon'), (0, _lib.useKeyOnly)(info, 'info'), (0, _lib.useKeyOnly)(negative, 'negative'), (0, _lib.useKeyOnly)(positive, 'positive'), (0, _lib.useKeyOnly)(success, 'success'), (0, _lib.useKeyOnly)(visible, 'visible'), (0, _lib.useKeyOnly)(warning, 'warning'), (0, _lib.useKeyOrValueAndKey)(attached, 'attached'), 'message', className);
var dismissIcon = onDismiss && _react2.default.createElement(_Icon2.default, { name: 'close', onClick: this.handleDismiss });
var rest = (0, _lib.getUnhandledProps)(Message, this.props);
var ElementType = (0, _lib.getElementType)(Message, this.props);
if (!(0, _isNil3.default)(children)) {
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
dismissIcon,
children
);
}
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
dismissIcon,
_Icon2.default.create(icon),
(!(0, _isNil3.default)(header) || !(0, _isNil3.default)(content) || !(0, _isNil3.default)(list)) && _react2.default.createElement(
_MessageContent2.default,
null,
_MessageHeader2.default.create(header),
_MessageList2.default.create(list),
(0, _lib.createHTMLParagraph)(content)
)
);
}
}]);
return Message;
}(_react.Component);
Message._meta = {
name: 'Message',
type: _lib.META.TYPES.COLLECTION
};
Message.Content = _MessageContent2.default;
Message.Header = _MessageHeader2.default;
Message.List = _MessageList2.default;
Message.Item = _MessageItem2.default;
exports.default = Message;
process.env.NODE_ENV !== "production" ? Message.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** A message can be formatted to attach itself to other content. */
attached: _propTypes2.default.oneOfType([_propTypes2.default.bool, _propTypes2.default.oneOf(['bottom'])]),
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string,
/** A message can be formatted to be different colors. */
color: _propTypes2.default.oneOf(_lib.SUI.COLORS),
/** A message can only take up the width of its content. */
compact: _propTypes2.default.bool,
/** Shorthand for primary content. */
content: _lib.customPropTypes.contentShorthand,
/** A message may be formatted to display a negative message. Same as `negative`. */
error: _propTypes2.default.bool,
/** A message can float above content that it is related to. */
floating: _propTypes2.default.bool,
/** Shorthand for MessageHeader. */
header: _lib.customPropTypes.itemShorthand,
/** A message can be hidden. */
hidden: _propTypes2.default.bool,
/** A message can contain an icon. */
icon: _propTypes2.default.oneOfType([_lib.customPropTypes.itemShorthand, _propTypes2.default.bool]),
/** A message may be formatted to display information. */
info: _propTypes2.default.bool,
/** Array shorthand items for the MessageList. Mutually exclusive with children. */
list: _lib.customPropTypes.collectionShorthand,
/** A message may be formatted to display a negative message. Same as `error`. */
negative: _propTypes2.default.bool,
/**
* A message that the user can choose to hide.
* Called when the user clicks the "x" icon. This also adds the "x" icon.
*
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {object} data - All props.
*/
onDismiss: _propTypes2.default.func,
/** A message may be formatted to display a positive message. Same as `success`. */
positive: _propTypes2.default.bool,
/** A message may be formatted to display a positive message. Same as `positive`. */
success: _propTypes2.default.bool,
/** A message can have different sizes. */
size: _propTypes2.default.oneOf((0, _without3.default)(_lib.SUI.SIZES, 'medium')),
/** A message can be set to visible to force itself to be shown. */
visible: _propTypes2.default.bool,
/** A message may be formatted to display warning messages. */
warning: _propTypes2.default.bool
} : void 0;
Message.handledProps = ['as', 'attached', 'children', 'className', 'color', 'compact', 'content', 'error', 'floating', 'header', 'hidden', 'icon', 'info', 'list', 'negative', 'onDismiss', 'positive', 'size', 'success', 'visible', 'warning'];
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | 1 1 1 1 1 1 1 1 1 1 4 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* A message can contain a content.
*/
function MessageContent(props) {
var children = props.children,
className = props.className;
var classes = (0, _classnames2.default)('content', className);
var rest = (0, _lib.getUnhandledProps)(MessageContent, props);
var ElementType = (0, _lib.getElementType)(MessageContent, props);
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
children
);
}
MessageContent.handledProps = ['as', 'children', 'className'];
MessageContent._meta = {
name: 'MessageContent',
parent: 'Message',
type: _lib.META.TYPES.COLLECTION
};
process.env.NODE_ENV !== "production" ? MessageContent.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string
} : void 0;
exports.default = MessageContent;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | 1 1 1 1 1 1 1 1 1 1 1 1 5 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _isNil2 = require('lodash/isNil');
var _isNil3 = _interopRequireDefault(_isNil2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* A message can contain a header.
*/
function MessageHeader(props) {
var children = props.children,
className = props.className,
content = props.content;
var classes = (0, _classnames2.default)('header', className);
var rest = (0, _lib.getUnhandledProps)(MessageHeader, props);
var ElementType = (0, _lib.getElementType)(MessageHeader, props);
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
(0, _isNil3.default)(children) ? content : children
);
}
MessageHeader.handledProps = ['as', 'children', 'className', 'content'];
MessageHeader._meta = {
name: 'MessageHeader',
parent: 'Message',
type: _lib.META.TYPES.COLLECTION
};
process.env.NODE_ENV !== "production" ? MessageHeader.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string,
/** Shorthand for primary content. */
content: _lib.customPropTypes.itemShorthand
} : void 0;
MessageHeader.create = (0, _lib.createShorthandFactory)(MessageHeader, function (val) {
return { content: val };
});
exports.default = MessageHeader;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | 1 1 1 1 1 1 1 1 1 1 1 1 5 1 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _isNil2 = require('lodash/isNil');
var _isNil3 = _interopRequireDefault(_isNil2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* A message list can contain an item.
*/
function MessageItem(props) {
var children = props.children,
className = props.className,
content = props.content;
var classes = (0, _classnames2.default)('content', className);
var rest = (0, _lib.getUnhandledProps)(MessageItem, props);
var ElementType = (0, _lib.getElementType)(MessageItem, props);
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
(0, _isNil3.default)(children) ? content : children
);
}
MessageItem.handledProps = ['as', 'children', 'className', 'content'];
MessageItem._meta = {
name: 'MessageItem',
parent: 'Message',
type: _lib.META.TYPES.COLLECTION
};
process.env.NODE_ENV !== "production" ? MessageItem.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string,
/** Shorthand for primary content. */
content: _lib.customPropTypes.itemShorthand
} : void 0;
MessageItem.defaultProps = {
as: 'li'
};
MessageItem.create = (0, _lib.createShorthandFactory)(MessageItem, function (content) {
return { content: content };
});
exports.default = MessageItem;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 | 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 7 1 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _map2 = require('lodash/map');
var _map3 = _interopRequireDefault(_map2);
var _isNil2 = require('lodash/isNil');
var _isNil3 = _interopRequireDefault(_isNil2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
var _MessageItem = require('./MessageItem');
var _MessageItem2 = _interopRequireDefault(_MessageItem);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* A message can contain a list of items.
*/
function MessageList(props) {
var children = props.children,
className = props.className,
items = props.items;
var classes = (0, _classnames2.default)('list', className);
var rest = (0, _lib.getUnhandledProps)(MessageList, props);
var ElementType = (0, _lib.getElementType)(MessageList, props);
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
(0, _isNil3.default)(children) ? (0, _map3.default)(items, _MessageItem2.default.create) : children
);
}
MessageList.handledProps = ['as', 'children', 'className', 'items'];
MessageList._meta = {
name: 'MessageList',
parent: 'Message',
type: _lib.META.TYPES.COLLECTION
};
process.env.NODE_ENV !== "production" ? MessageList.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string,
/** Shorthand Message.Items. */
items: _lib.customPropTypes.collectionShorthand
} : void 0;
MessageList.defaultProps = {
as: 'ul'
};
MessageList.create = (0, _lib.createShorthandFactory)(MessageList, function (val) {
return { items: val };
});
exports.default = MessageList;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = undefined;
var _Message = require('./Message');
var _Message2 = _interopRequireDefault(_Message);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = _Message2.default;
|
| File | Statements | Branches | Functions | Lines | |||||
|---|---|---|---|---|---|---|---|---|---|
| Table.js | 84% | (42 / 50) | 35.71% | (5 / 14) | 33.33% | (1 / 3) | 83.67% | (41 / 49) | |
| TableBody.js | 78.26% | (18 / 23) | 83.33% | (5 / 6) | 50% | (1 / 2) | 77.27% | (17 / 22) | |
| TableCell.js | 75.76% | (25 / 33) | 62.5% | (5 / 8) | 33.33% | (1 / 3) | 75% | (24 / 32) | |
| TableFooter.js | 92.86% | (13 / 14) | 100% | (4 / 4) | 50% | (1 / 2) | 92.31% | (12 / 13) | |
| TableHeader.js | 78.26% | (18 / 23) | 83.33% | (5 / 6) | 50% | (1 / 2) | 77.27% | (17 / 22) | |
| TableHeaderCell.js | 83.33% | (20 / 24) | 83.33% | (5 / 6) | 50% | (1 / 2) | 82.61% | (19 / 23) | |
| TableRow.js | 75% | (27 / 36) | 62.5% | (5 / 8) | 25% | (1 / 4) | 74.29% | (26 / 35) | |
| index.js | 100% | (7 / 7) | 75% | (3 / 4) | 100% | (1 / 1) | 100% | (6 / 6) |
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 | 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 13 1 1 1 1 1 1 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _without2 = require('lodash/without');
var _without3 = _interopRequireDefault(_without2);
var _map2 = require('lodash/map');
var _map3 = _interopRequireDefault(_map2);
var _isNil2 = require('lodash/isNil');
var _isNil3 = _interopRequireDefault(_isNil2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
var _TableBody = require('./TableBody');
var _TableBody2 = _interopRequireDefault(_TableBody);
var _TableCell = require('./TableCell');
var _TableCell2 = _interopRequireDefault(_TableCell);
var _TableFooter = require('./TableFooter');
var _TableFooter2 = _interopRequireDefault(_TableFooter);
var _TableHeader = require('./TableHeader');
var _TableHeader2 = _interopRequireDefault(_TableHeader);
var _TableHeaderCell = require('./TableHeaderCell');
var _TableHeaderCell2 = _interopRequireDefault(_TableHeaderCell);
var _TableRow = require('./TableRow');
var _TableRow2 = _interopRequireDefault(_TableRow);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* A table displays a collections of data grouped into rows.
*/
function Table(props) {
var attached = props.attached,
basic = props.basic,
celled = props.celled,
children = props.children,
className = props.className,
collapsing = props.collapsing,
color = props.color,
columns = props.columns,
compact = props.compact,
definition = props.definition,
fixed = props.fixed,
footerRow = props.footerRow,
headerRow = props.headerRow,
inverted = props.inverted,
padded = props.padded,
renderBodyRow = props.renderBodyRow,
selectable = props.selectable,
singleLine = props.singleLine,
size = props.size,
sortable = props.sortable,
stackable = props.stackable,
striped = props.striped,
structured = props.structured,
tableData = props.tableData,
textAlign = props.textAlign,
unstackable = props.unstackable,
verticalAlign = props.verticalAlign;
var classes = (0, _classnames2.default)('ui', color, size, (0, _lib.useKeyOnly)(celled, 'celled'), (0, _lib.useKeyOnly)(collapsing, 'collapsing'), (0, _lib.useKeyOnly)(definition, 'definition'), (0, _lib.useKeyOnly)(fixed, 'fixed'), (0, _lib.useKeyOnly)(inverted, 'inverted'), (0, _lib.useKeyOnly)(selectable, 'selectable'), (0, _lib.useKeyOnly)(singleLine, 'single line'), (0, _lib.useKeyOnly)(sortable, 'sortable'), (0, _lib.useKeyOnly)(stackable, 'stackable'), (0, _lib.useKeyOnly)(striped, 'striped'), (0, _lib.useKeyOnly)(structured, 'structured'), (0, _lib.useKeyOnly)(unstackable, 'unstackable'), (0, _lib.useKeyOrValueAndKey)(attached, 'attached'), (0, _lib.useKeyOrValueAndKey)(basic, 'basic'), (0, _lib.useKeyOrValueAndKey)(compact, 'compact'), (0, _lib.useKeyOrValueAndKey)(padded, 'padded'), (0, _lib.useTextAlignProp)(textAlign), (0, _lib.useVerticalAlignProp)(verticalAlign), (0, _lib.useWidthProp)(columns, 'column'), 'table', className);
var rest = (0, _lib.getUnhandledProps)(Table, props);
var ElementType = (0, _lib.getElementType)(Table, props);
if (!(0, _isNil3.default)(children)) {
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
children
);
}
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
headerRow && _react2.default.createElement(
_TableHeader2.default,
null,
_TableRow2.default.create(headerRow, { defaultProps: { cellAs: 'th' } })
),
_react2.default.createElement(
_TableBody2.default,
null,
renderBodyRow && (0, _map3.default)(tableData, function (data, index) {
return _TableRow2.default.create(renderBodyRow(data, index));
})
),
footerRow && _react2.default.createElement(
_TableFooter2.default,
null,
_TableRow2.default.create(footerRow)
)
);
}
Table.handledProps = ['as', 'attached', 'basic', 'celled', 'children', 'className', 'collapsing', 'color', 'columns', 'compact', 'definition', 'fixed', 'footerRow', 'headerRow', 'inverted', 'padded', 'renderBodyRow', 'selectable', 'singleLine', 'size', 'sortable', 'stackable', 'striped', 'structured', 'tableData', 'textAlign', 'unstackable', 'verticalAlign'];
Table._meta = {
name: 'Table',
type: _lib.META.TYPES.COLLECTION
};
Table.defaultProps = {
as: 'table'
};
process.env.NODE_ENV !== "production" ? Table.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Attach table to other content */
attached: _propTypes2.default.oneOfType([_propTypes2.default.bool, _propTypes2.default.oneOf(['top', 'bottom'])]),
/** A table can reduce its complexity to increase readability. */
basic: _propTypes2.default.oneOfType([_propTypes2.default.oneOf(['very']), _propTypes2.default.bool]),
/** A table may be divided each row into separate cells. */
celled: _propTypes2.default.bool,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string,
/** A table can be collapsing, taking up only as much space as its rows. */
collapsing: _propTypes2.default.bool,
/** A table can be given a color to distinguish it from other tables. */
color: _propTypes2.default.oneOf(_lib.SUI.COLORS),
/** A table can specify its column count to divide its content evenly. */
columns: _propTypes2.default.oneOf(_lib.SUI.WIDTHS),
/** A table may sometimes need to be more compact to make more rows visible at a time. */
compact: _propTypes2.default.oneOfType([_propTypes2.default.bool, _propTypes2.default.oneOf(['very'])]),
/** A table may be formatted to emphasize a first column that defines a rows content. */
definition: _propTypes2.default.bool,
/**
* A table can use fixed a special faster form of table rendering that does not resize table cells based on content
*/
fixed: _propTypes2.default.bool,
/** Shorthand for a TableRow to be placed within Table.Footer. */
footerRow: _lib.customPropTypes.itemShorthand,
/** Shorthand for a TableRow to be placed within Table.Header. */
headerRow: _lib.customPropTypes.itemShorthand,
/** A table's colors can be inverted. */
inverted: _propTypes2.default.bool,
/** A table may sometimes need to be more padded for legibility. */
padded: _propTypes2.default.oneOfType([_propTypes2.default.bool, _propTypes2.default.oneOf(['very'])]),
/**
* Mapped over `tableData` and should return shorthand for each Table.Row to be placed within Table.Body.
*
* @param {*} data - An element in the `tableData` array.
* @param {number} index - The index of the current element in `tableData`.
* @returns {*} Shorthand for a Table.Row.
*/
renderBodyRow: _lib.customPropTypes.every([_lib.customPropTypes.disallow(['children']), _lib.customPropTypes.demand(['tableData']), _propTypes2.default.func]),
/** A table can have its rows appear selectable. */
selectable: _propTypes2.default.bool,
/** A table can specify that its cell contents should remain on a single line and not wrap. */
singleLine: _propTypes2.default.bool,
/** A table can also be small or large. */
size: _propTypes2.default.oneOf((0, _without3.default)(_lib.SUI.SIZES, 'mini', 'tiny', 'medium', 'big', 'huge', 'massive')),
/** A table may allow a user to sort contents by clicking on a table header. */
sortable: _propTypes2.default.bool,
/** A table can specify how it stacks table content responsively. */
stackable: _propTypes2.default.bool,
/** A table can stripe alternate rows of content with a darker color to increase contrast. */
striped: _propTypes2.default.bool,
/** A table can be formatted to display complex structured data. */
structured: _propTypes2.default.bool,
/** Data to be passed to the renderBodyRow function. */
tableData: _lib.customPropTypes.every([_lib.customPropTypes.disallow(['children']), _lib.customPropTypes.demand(['renderBodyRow']), _propTypes2.default.array]),
/** A table can adjust its text alignment. */
textAlign: _propTypes2.default.oneOf((0, _without3.default)(_lib.SUI.TEXT_ALIGNMENTS, 'justified')),
/** A table can specify how it stacks table content responsively. */
unstackable: _propTypes2.default.bool,
/** A table can adjust its text alignment. */
verticalAlign: _propTypes2.default.oneOf(_lib.SUI.VERTICAL_ALIGNMENTS)
} : void 0;
Table.Body = _TableBody2.default;
Table.Cell = _TableCell2.default;
Table.Footer = _TableFooter2.default;
Table.Header = _TableHeader2.default;
Table.HeaderCell = _TableHeaderCell2.default;
Table.Row = _TableRow2.default;
exports.default = Table;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | 1 1 1 1 1 1 1 1 1 1 4 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function TableBody(props) {
var children = props.children,
className = props.className;
var classes = (0, _classnames2.default)(className);
var rest = (0, _lib.getUnhandledProps)(TableBody, props);
var ElementType = (0, _lib.getElementType)(TableBody, props);
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
children
);
}
TableBody.handledProps = ['as', 'children', 'className'];
TableBody._meta = {
name: 'TableBody',
type: _lib.META.TYPES.COLLECTION,
parent: 'Table'
};
TableBody.defaultProps = {
as: 'tbody'
};
process.env.NODE_ENV !== "production" ? TableBody.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string
} : void 0;
exports.default = TableBody;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 | 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 7 1 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _without2 = require('lodash/without');
var _without3 = _interopRequireDefault(_without2);
var _isNil2 = require('lodash/isNil');
var _isNil3 = _interopRequireDefault(_isNil2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
var _Icon = require('../../elements/Icon');
var _Icon2 = _interopRequireDefault(_Icon);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* A table row can have cells.
*/
function TableCell(props) {
var active = props.active,
children = props.children,
className = props.className,
collapsing = props.collapsing,
content = props.content,
disabled = props.disabled,
error = props.error,
icon = props.icon,
negative = props.negative,
positive = props.positive,
selectable = props.selectable,
singleLine = props.singleLine,
textAlign = props.textAlign,
verticalAlign = props.verticalAlign,
warning = props.warning,
width = props.width;
var classes = (0, _classnames2.default)((0, _lib.useKeyOnly)(active, 'active'), (0, _lib.useKeyOnly)(collapsing, 'collapsing'), (0, _lib.useKeyOnly)(disabled, 'disabled'), (0, _lib.useKeyOnly)(error, 'error'), (0, _lib.useKeyOnly)(negative, 'negative'), (0, _lib.useKeyOnly)(positive, 'positive'), (0, _lib.useKeyOnly)(selectable, 'selectable'), (0, _lib.useKeyOnly)(singleLine, 'single line'), (0, _lib.useKeyOnly)(warning, 'warning'), (0, _lib.useTextAlignProp)(textAlign), (0, _lib.useVerticalAlignProp)(verticalAlign), (0, _lib.useWidthProp)(width, 'wide'), className);
var rest = (0, _lib.getUnhandledProps)(TableCell, props);
var ElementType = (0, _lib.getElementType)(TableCell, props);
if (!(0, _isNil3.default)(children)) {
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
children
);
}
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
_Icon2.default.create(icon),
content
);
}
TableCell.handledProps = ['active', 'as', 'children', 'className', 'collapsing', 'content', 'disabled', 'error', 'icon', 'negative', 'positive', 'selectable', 'singleLine', 'textAlign', 'verticalAlign', 'warning', 'width'];
TableCell._meta = {
name: 'TableCell',
type: _lib.META.TYPES.COLLECTION,
parent: 'Table'
};
TableCell.defaultProps = {
as: 'td'
};
process.env.NODE_ENV !== "production" ? TableCell.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** A cell can be active or selected by a user. */
active: _propTypes2.default.bool,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string,
/** A cell can be collapsing so that it only uses as much space as required. */
collapsing: _propTypes2.default.bool,
/** Shorthand for primary content. */
content: _lib.customPropTypes.contentShorthand,
/** A cell can be disabled. */
disabled: _propTypes2.default.bool,
/** A cell may call attention to an error or a negative value. */
error: _propTypes2.default.bool,
/** Add an Icon by name, props object, or pass an <Icon /> */
icon: _lib.customPropTypes.itemShorthand,
/** A cell may let a user know whether a value is bad. */
negative: _propTypes2.default.bool,
/** A cell may let a user know whether a value is good. */
positive: _propTypes2.default.bool,
/** A cell can be selectable. */
selectable: _propTypes2.default.bool,
/** A cell can specify that its contents should remain on a single line and not wrap. */
singleLine: _propTypes2.default.bool,
/** A table cell can adjust its text alignment. */
textAlign: _propTypes2.default.oneOf((0, _without3.default)(_lib.SUI.TEXT_ALIGNMENTS, 'justified')),
/** A table cell can adjust its text alignment. */
verticalAlign: _propTypes2.default.oneOf(_lib.SUI.VERTICAL_ALIGNMENTS),
/** A cell may warn a user. */
warning: _propTypes2.default.bool,
/** A table can specify the width of individual columns independently. */
width: _propTypes2.default.oneOf(_lib.SUI.WIDTHS)
} : void 0;
TableCell.create = (0, _lib.createShorthandFactory)(TableCell, function (content) {
return { content: content };
});
exports.default = TableCell;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 | 1 1 1 1 1 1 2 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
var _TableHeader = require('./TableHeader');
var _TableHeader2 = _interopRequireDefault(_TableHeader);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* A table can have a footer.
*/
function TableFooter(props) {
return _react2.default.createElement(_TableHeader2.default, props);
}
TableFooter.handledProps = ['as'];
TableFooter._meta = {
name: 'TableFooter',
type: _lib.META.TYPES.COLLECTION,
parent: 'Table'
};
TableFooter.defaultProps = {
as: 'tfoot'
};
exports.default = TableFooter;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | 1 1 1 1 1 1 1 1 1 1 4 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* A table can have a header.
*/
function TableHeader(props) {
var children = props.children,
className = props.className,
fullWidth = props.fullWidth;
var classes = (0, _classnames2.default)((0, _lib.useKeyOnly)(fullWidth, 'full-width'), className);
var rest = (0, _lib.getUnhandledProps)(TableHeader, props);
var ElementType = (0, _lib.getElementType)(TableHeader, props);
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
children
);
}
TableHeader.handledProps = ['as', 'children', 'className', 'fullWidth'];
TableHeader._meta = {
name: 'TableHeader',
type: _lib.META.TYPES.COLLECTION,
parent: 'Table'
};
TableHeader.defaultProps = {
as: 'thead'
};
process.env.NODE_ENV !== "production" ? TableHeader.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string,
/** A definition table can have a full width header or footer, filling in the gap left by the first column. */
fullWidth: _propTypes2.default.bool
} : void 0;
exports.default = TableHeader;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | 1 1 1 1 1 1 1 1 1 1 1 1 5 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
var _TableCell = require('./TableCell');
var _TableCell2 = _interopRequireDefault(_TableCell);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* A table can have a header cell.
*/
function TableHeaderCell(props) {
var as = props.as,
className = props.className,
sorted = props.sorted;
var classes = (0, _classnames2.default)((0, _lib.useValueAndKey)(sorted, 'sorted'), className);
var rest = (0, _lib.getUnhandledProps)(TableHeaderCell, props);
return _react2.default.createElement(_TableCell2.default, (0, _extends3.default)({}, rest, { as: as, className: classes }));
}
TableHeaderCell.handledProps = ['as', 'className', 'sorted'];
TableHeaderCell._meta = {
name: 'TableHeaderCell',
type: _lib.META.TYPES.COLLECTION,
parent: 'Table'
};
process.env.NODE_ENV !== "production" ? TableHeaderCell.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Additional classes. */
className: _propTypes2.default.string,
/** A header cell can be sorted in ascending or descending order. */
sorted: _propTypes2.default.oneOf(['ascending', 'descending'])
} : void 0;
TableHeaderCell.defaultProps = {
as: 'th'
};
exports.default = TableHeaderCell;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 | 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 8 1 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _without2 = require('lodash/without');
var _without3 = _interopRequireDefault(_without2);
var _map2 = require('lodash/map');
var _map3 = _interopRequireDefault(_map2);
var _isNil2 = require('lodash/isNil');
var _isNil3 = _interopRequireDefault(_isNil2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
var _TableCell = require('./TableCell');
var _TableCell2 = _interopRequireDefault(_TableCell);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* A table can have rows.
*/
function TableRow(props) {
var active = props.active,
cellAs = props.cellAs,
cells = props.cells,
children = props.children,
className = props.className,
disabled = props.disabled,
error = props.error,
negative = props.negative,
positive = props.positive,
textAlign = props.textAlign,
verticalAlign = props.verticalAlign,
warning = props.warning;
var classes = (0, _classnames2.default)((0, _lib.useKeyOnly)(active, 'active'), (0, _lib.useKeyOnly)(disabled, 'disabled'), (0, _lib.useKeyOnly)(error, 'error'), (0, _lib.useKeyOnly)(negative, 'negative'), (0, _lib.useKeyOnly)(positive, 'positive'), (0, _lib.useKeyOnly)(warning, 'warning'), (0, _lib.useTextAlignProp)(textAlign), (0, _lib.useVerticalAlignProp)(verticalAlign), className);
var rest = (0, _lib.getUnhandledProps)(TableRow, props);
var ElementType = (0, _lib.getElementType)(TableRow, props);
if (!(0, _isNil3.default)(children)) {
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
children
);
}
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
(0, _map3.default)(cells, function (cell) {
return _TableCell2.default.create(cell, { defaultProps: { as: cellAs } });
})
);
}
TableRow.handledProps = ['active', 'as', 'cellAs', 'cells', 'children', 'className', 'disabled', 'error', 'negative', 'positive', 'textAlign', 'verticalAlign', 'warning'];
TableRow._meta = {
name: 'TableRow',
type: _lib.META.TYPES.COLLECTION,
parent: 'Table'
};
TableRow.defaultProps = {
as: 'tr',
cellAs: 'td'
};
process.env.NODE_ENV !== "production" ? TableRow.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** A row can be active or selected by a user. */
active: _propTypes2.default.bool,
/** An element type to render as (string or function). */
cellAs: _lib.customPropTypes.as,
/** Shorthand array of props for TableCell. */
cells: _lib.customPropTypes.collectionShorthand,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string,
/** A row can be disabled. */
disabled: _propTypes2.default.bool,
/** A row may call attention to an error or a negative value. */
error: _propTypes2.default.bool,
/** A row may let a user know whether a value is bad. */
negative: _propTypes2.default.bool,
/** A row may let a user know whether a value is good. */
positive: _propTypes2.default.bool,
/** A table row can adjust its text alignment. */
textAlign: _propTypes2.default.oneOf((0, _without3.default)(_lib.SUI.TEXT_ALIGNMENTS, 'justified')),
/** A table row can adjust its vertical alignment. */
verticalAlign: _propTypes2.default.oneOf(_lib.SUI.VERTICAL_ALIGNMENTS),
/** A row may warn a user. */
warning: _propTypes2.default.bool
} : void 0;
TableRow.create = (0, _lib.createShorthandFactory)(TableRow, function (cells) {
return { cells: cells };
});
exports.default = TableRow;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = undefined;
var _Table = require('./Table');
var _Table2 = _interopRequireDefault(_Table);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = _Table2.default;
|
| File | Statements | Branches | Functions | Lines | |||||
|---|---|---|---|---|---|---|---|---|---|
| Button.js | 51.04% | (49 / 96) | 11.36% | (5 / 44) | 25% | (2 / 8) | 53.33% | (48 / 90) | |
| ButtonContent.js | 77.27% | (17 / 22) | 83.33% | (5 / 6) | 50% | (1 / 2) | 76.19% | (16 / 21) | |
| ButtonGroup.js | 77.27% | (17 / 22) | 83.33% | (5 / 6) | 50% | (1 / 2) | 76.19% | (16 / 21) | |
| ButtonOr.js | 77.27% | (17 / 22) | 83.33% | (5 / 6) | 50% | (1 / 2) | 76.19% | (16 / 21) | |
| index.js | 100% | (7 / 7) | 75% | (3 / 4) | 100% | (1 / 1) | 100% | (6 / 6) |
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 | 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 15 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _toConsumableArray2 = require('babel-runtime/helpers/toConsumableArray');
var _toConsumableArray3 = _interopRequireDefault(_toConsumableArray2);
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
var _createClass2 = require('babel-runtime/helpers/createClass');
var _createClass3 = _interopRequireDefault(_createClass2);
var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
var _inherits2 = require('babel-runtime/helpers/inherits');
var _inherits3 = _interopRequireDefault(_inherits2);
var _isNil2 = require('lodash/isNil');
var _isNil3 = _interopRequireDefault(_isNil2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
var _Icon = require('../Icon/Icon');
var _Icon2 = _interopRequireDefault(_Icon);
var _Label = require('../Label/Label');
var _Label2 = _interopRequireDefault(_Label);
var _ButtonContent = require('./ButtonContent');
var _ButtonContent2 = _interopRequireDefault(_ButtonContent);
var _ButtonGroup = require('./ButtonGroup');
var _ButtonGroup2 = _interopRequireDefault(_ButtonGroup);
var _ButtonOr = require('./ButtonOr');
var _ButtonOr2 = _interopRequireDefault(_ButtonOr);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var debug = (0, _lib.makeDebugger)('button');
/**
* A Button indicates a possible user action.
* @see Form
* @see Icon
* @see Label
*/
var Button = function (_Component) {
(0, _inherits3.default)(Button, _Component);
function Button() {
var _ref;
var _temp, _this, _ret;
(0, _classCallCheck3.default)(this, Button);
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return _ret = (_temp = (_this = (0, _possibleConstructorReturn3.default)(this, (_ref = Button.__proto__ || Object.getPrototypeOf(Button)).call.apply(_ref, [this].concat(args))), _this), _this.computeElementType = function () {
var _this$props = _this.props,
attached = _this$props.attached,
label = _this$props.label;
if (!(0, _isNil3.default)(attached) || !(0, _isNil3.default)(label)) return 'div';
}, _this.computeTabIndex = function (ElementType) {
var _this$props2 = _this.props,
disabled = _this$props2.disabled,
tabIndex = _this$props2.tabIndex;
if (!(0, _isNil3.default)(tabIndex)) return tabIndex;
if (disabled) return -1;
if (ElementType === 'div') return 0;
}, _this.handleClick = function (e) {
var _this$props3 = _this.props,
disabled = _this$props3.disabled,
onClick = _this$props3.onClick;
if (disabled) {
e.preventDefault();
return;
}
if (onClick) onClick(e, _this.props);
}, _temp), (0, _possibleConstructorReturn3.default)(_this, _ret);
}
(0, _createClass3.default)(Button, [{
key: 'render',
value: function render() {
var _props = this.props,
active = _props.active,
animated = _props.animated,
attached = _props.attached,
basic = _props.basic,
children = _props.children,
circular = _props.circular,
className = _props.className,
color = _props.color,
compact = _props.compact,
content = _props.content,
disabled = _props.disabled,
floated = _props.floated,
fluid = _props.fluid,
icon = _props.icon,
inverted = _props.inverted,
label = _props.label,
labelPosition = _props.labelPosition,
loading = _props.loading,
negative = _props.negative,
positive = _props.positive,
primary = _props.primary,
secondary = _props.secondary,
size = _props.size,
toggle = _props.toggle;
var baseClasses = (0, _classnames2.default)(color, size, (0, _lib.useKeyOnly)(active, 'active'), (0, _lib.useKeyOnly)(basic, 'basic'), (0, _lib.useKeyOnly)(circular, 'circular'), (0, _lib.useKeyOnly)(compact, 'compact'), (0, _lib.useKeyOnly)(fluid, 'fluid'), (0, _lib.useKeyOnly)(icon === true || icon && (labelPosition || !children && !content), 'icon'), (0, _lib.useKeyOnly)(inverted, 'inverted'), (0, _lib.useKeyOnly)(loading, 'loading'), (0, _lib.useKeyOnly)(negative, 'negative'), (0, _lib.useKeyOnly)(positive, 'positive'), (0, _lib.useKeyOnly)(primary, 'primary'), (0, _lib.useKeyOnly)(secondary, 'secondary'), (0, _lib.useKeyOnly)(toggle, 'toggle'), (0, _lib.useKeyOrValueAndKey)(animated, 'animated'), (0, _lib.useKeyOrValueAndKey)(attached, 'attached'));
var labeledClasses = (0, _classnames2.default)((0, _lib.useKeyOrValueAndKey)(labelPosition || !!label, 'labeled'));
var wrapperClasses = (0, _classnames2.default)((0, _lib.useKeyOnly)(disabled, 'disabled'), (0, _lib.useValueAndKey)(floated, 'floated'));
var rest = (0, _lib.getUnhandledProps)(Button, this.props);
var ElementType = (0, _lib.getElementType)(Button, this.props, this.computeElementType);
var tabIndex = this.computeTabIndex(ElementType);
if (!(0, _isNil3.default)(children)) {
var _classes = (0, _classnames2.default)('ui', baseClasses, wrapperClasses, labeledClasses, 'button', className);
debug('render children:', { classes: _classes });
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: _classes, tabIndex: tabIndex, onClick: this.handleClick }),
children
);
}
var labelElement = _Label2.default.create(label, { defaultProps: {
basic: true,
pointing: labelPosition === 'left' ? 'right' : 'left'
} });
if (labelElement) {
var _classes2 = (0, _classnames2.default)('ui', baseClasses, 'button', className);
var containerClasses = (0, _classnames2.default)('ui', labeledClasses, 'button', className, wrapperClasses);
debug('render label:', { classes: _classes2, containerClasses: containerClasses }, this.props);
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: containerClasses, onClick: this.handleClick }),
labelPosition === 'left' && labelElement,
_react2.default.createElement(
'button',
{ className: _classes2, tabIndex: tabIndex },
_Icon2.default.create(icon),
' ',
content
),
(labelPosition === 'right' || !labelPosition) && labelElement
);
}
if (!(0, _isNil3.default)(icon) && (0, _isNil3.default)(label)) {
var _classes3 = (0, _classnames2.default)('ui', labeledClasses, baseClasses, 'button', className, wrapperClasses);
debug('render icon && !label:', { classes: _classes3 });
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: _classes3, tabIndex: tabIndex, onClick: this.handleClick }),
_Icon2.default.create(icon),
' ',
content
);
}
var classes = (0, _classnames2.default)('ui', labeledClasses, baseClasses, 'button', className, wrapperClasses);
debug('render default:', { classes: classes });
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes, tabIndex: tabIndex, onClick: this.handleClick }),
content
);
}
}]);
return Button;
}(_react.Component);
Button.defaultProps = {
as: 'button'
};
Button._meta = {
name: 'Button',
type: _lib.META.TYPES.ELEMENT
};
Button.Content = _ButtonContent2.default;
Button.Group = _ButtonGroup2.default;
Button.Or = _ButtonOr2.default;
process.env.NODE_ENV !== "production" ? Button.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** A button can show it is currently the active user selection. */
active: _propTypes2.default.bool,
/** A button can animate to show hidden content. */
animated: _propTypes2.default.oneOfType([_propTypes2.default.bool, _propTypes2.default.oneOf(['fade', 'vertical'])]),
/** A button can be attached to the top or bottom of other content. */
attached: _propTypes2.default.oneOf(['left', 'right', 'top', 'bottom']),
/** A basic button is less pronounced. */
basic: _propTypes2.default.bool,
/** Primary content. */
children: _lib.customPropTypes.every([_propTypes2.default.node, _lib.customPropTypes.disallow(['label']), _lib.customPropTypes.givenProps({
icon: _propTypes2.default.oneOfType([_propTypes2.default.string.isRequired, _propTypes2.default.object.isRequired, _propTypes2.default.element.isRequired])
}, _lib.customPropTypes.disallow(['icon']))]),
/** Additional classes. */
className: _propTypes2.default.string,
/** A button can be circular. */
circular: _propTypes2.default.bool,
/** A button can have different colors */
color: _propTypes2.default.oneOf([].concat((0, _toConsumableArray3.default)(_lib.SUI.COLORS), ['facebook', 'google plus', 'instagram', 'linkedin', 'twitter', 'vk', 'youtube'])),
/** A button can reduce its padding to fit into tighter spaces. */
compact: _propTypes2.default.bool,
/** Shorthand for primary content. */
content: _lib.customPropTypes.contentShorthand,
/** A button can show it is currently unable to be interacted with. */
disabled: _propTypes2.default.bool,
/** A button can be aligned to the left or right of its container. */
floated: _propTypes2.default.oneOf(_lib.SUI.FLOATS),
/** A button can take the width of its container. */
fluid: _propTypes2.default.bool,
/** Add an Icon by name, props object, or pass an <Icon />. */
icon: _lib.customPropTypes.some([_propTypes2.default.bool, _propTypes2.default.string, _propTypes2.default.object, _propTypes2.default.element]),
/** A button can be formatted to appear on dark backgrounds. */
inverted: _propTypes2.default.bool,
/** Add a Label by text, props object, or pass a <Label />. */
label: _lib.customPropTypes.some([_propTypes2.default.string, _propTypes2.default.object, _propTypes2.default.element]),
/** A labeled button can format a Label or Icon to appear on the left or right. */
labelPosition: _propTypes2.default.oneOf(['right', 'left']),
/** A button can show a loading indicator. */
loading: _propTypes2.default.bool,
/** A button can hint towards a negative consequence. */
negative: _propTypes2.default.bool,
/**
* Called after user's click.
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {object} data - All props.
*/
onClick: _propTypes2.default.func,
/** A button can hint towards a positive consequence. */
positive: _propTypes2.default.bool,
/** A button can be formatted to show different levels of emphasis. */
primary: _propTypes2.default.bool,
/** A button can be formatted to show different levels of emphasis. */
secondary: _propTypes2.default.bool,
/** A button can have different sizes. */
size: _propTypes2.default.oneOf(_lib.SUI.SIZES),
/** A button can receive focus. */
tabIndex: _propTypes2.default.oneOfType([_propTypes2.default.number, _propTypes2.default.string]),
/** A button can be formatted to toggle on and off. */
toggle: _propTypes2.default.bool
} : void 0;
Button.handledProps = ['active', 'animated', 'as', 'attached', 'basic', 'children', 'circular', 'className', 'color', 'compact', 'content', 'disabled', 'floated', 'fluid', 'icon', 'inverted', 'label', 'labelPosition', 'loading', 'negative', 'onClick', 'positive', 'primary', 'secondary', 'size', 'tabIndex', 'toggle'];
Button.create = (0, _lib.createShorthandFactory)(Button, function (value) {
return { content: value };
});
exports.default = Button;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | 1 1 1 1 1 1 1 1 1 1 4 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* Used in some Button types, such as `animated`.
*/
function ButtonContent(props) {
var children = props.children,
className = props.className,
hidden = props.hidden,
visible = props.visible;
var classes = (0, _classnames2.default)((0, _lib.useKeyOnly)(visible, 'visible'), (0, _lib.useKeyOnly)(hidden, 'hidden'), 'content', className);
var rest = (0, _lib.getUnhandledProps)(ButtonContent, props);
var ElementType = (0, _lib.getElementType)(ButtonContent, props);
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
children
);
}
ButtonContent.handledProps = ['as', 'children', 'className', 'hidden', 'visible'];
ButtonContent._meta = {
name: 'ButtonContent',
parent: 'Button',
type: _lib.META.TYPES.ELEMENT
};
process.env.NODE_ENV !== "production" ? ButtonContent.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string,
/** Initially hidden, visible on hover. */
hidden: _propTypes2.default.bool,
/** Initially visible, hidden on hover. */
visible: _propTypes2.default.bool
} : void 0;
exports.default = ButtonContent;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 | 1 1 1 1 1 1 1 1 1 1 4 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* Buttons can be grouped.
*/
function ButtonGroup(props) {
var attached = props.attached,
basic = props.basic,
children = props.children,
className = props.className,
color = props.color,
compact = props.compact,
floated = props.floated,
fluid = props.fluid,
icon = props.icon,
inverted = props.inverted,
labeled = props.labeled,
negative = props.negative,
positive = props.positive,
primary = props.primary,
secondary = props.secondary,
size = props.size,
toggle = props.toggle,
vertical = props.vertical,
widths = props.widths;
var classes = (0, _classnames2.default)('ui', color, size, (0, _lib.useKeyOnly)(basic, 'basic'), (0, _lib.useKeyOnly)(compact, 'compact'), (0, _lib.useKeyOnly)(fluid, 'fluid'), (0, _lib.useKeyOnly)(icon, 'icon'), (0, _lib.useKeyOnly)(inverted, 'inverted'), (0, _lib.useKeyOnly)(labeled, 'labeled'), (0, _lib.useKeyOnly)(negative, 'negative'), (0, _lib.useKeyOnly)(positive, 'positive'), (0, _lib.useKeyOnly)(primary, 'primary'), (0, _lib.useKeyOnly)(secondary, 'secondary'), (0, _lib.useKeyOnly)(toggle, 'toggle'), (0, _lib.useKeyOnly)(vertical, 'vertical'), (0, _lib.useValueAndKey)(attached, 'attached'), (0, _lib.useValueAndKey)(floated, 'floated'), (0, _lib.useWidthProp)(widths), 'buttons', className);
var rest = (0, _lib.getUnhandledProps)(ButtonGroup, props);
var ElementType = (0, _lib.getElementType)(ButtonGroup, props);
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
children
);
}
ButtonGroup.handledProps = ['as', 'attached', 'basic', 'children', 'className', 'color', 'compact', 'floated', 'fluid', 'icon', 'inverted', 'labeled', 'negative', 'positive', 'primary', 'secondary', 'size', 'toggle', 'vertical', 'widths'];
ButtonGroup._meta = {
name: 'ButtonGroup',
parent: 'Button',
type: _lib.META.TYPES.ELEMENT
};
process.env.NODE_ENV !== "production" ? ButtonGroup.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** A button can be attached to the top or bottom of other content. */
attached: _propTypes2.default.oneOf(['left', 'right', 'top', 'bottom']),
/** Groups can be less pronounced. */
basic: _propTypes2.default.bool,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string,
/** Groups can have a shared color. */
color: _propTypes2.default.oneOf(_lib.SUI.COLORS),
/** Groups can reduce their padding to fit into tighter spaces. */
compact: _propTypes2.default.bool,
/** Groups can be aligned to the left or right of its container. */
floated: _propTypes2.default.oneOf(_lib.SUI.FLOATS),
/** Groups can take the width of their container. */
fluid: _propTypes2.default.bool,
/** Groups can be formatted as icons. */
icon: _propTypes2.default.bool,
/** Groups can be formatted to appear on dark backgrounds. */
inverted: _propTypes2.default.bool,
/** Groups can be formatted as labeled icon buttons. */
labeled: _propTypes2.default.bool,
/** Groups can hint towards a negative consequence. */
negative: _propTypes2.default.bool,
/** Groups can hint towards a positive consequence. */
positive: _propTypes2.default.bool,
/** Groups can be formatted to show different levels of emphasis. */
primary: _propTypes2.default.bool,
/** Groups can be formatted to show different levels of emphasis. */
secondary: _propTypes2.default.bool,
/** Groups can have different sizes. */
size: _propTypes2.default.oneOf(_lib.SUI.SIZES),
/** Groups can be formatted to toggle on and off. */
toggle: _propTypes2.default.bool,
/** Groups can be formatted to appear vertically. */
vertical: _propTypes2.default.bool,
/** Groups can have their widths divided evenly. */
widths: _propTypes2.default.oneOf(_lib.SUI.WIDTHS)
} : void 0;
exports.default = ButtonGroup;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | 1 1 1 1 1 1 1 1 1 1 4 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* Button groups can contain conditionals.
*/
function ButtonOr(props) {
var className = props.className,
text = props.text;
var classes = (0, _classnames2.default)('or', className);
var rest = (0, _lib.getUnhandledProps)(ButtonOr, props);
var ElementType = (0, _lib.getElementType)(ButtonOr, props);
return _react2.default.createElement(ElementType, (0, _extends3.default)({}, rest, { className: classes, 'data-text': text }));
}
ButtonOr.handledProps = ['as', 'className', 'text'];
ButtonOr._meta = {
name: 'ButtonOr',
parent: 'Button',
type: _lib.META.TYPES.ELEMENT
};
process.env.NODE_ENV !== "production" ? ButtonOr.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Additional classes. */
className: _propTypes2.default.string,
/** Or buttons can have their text localized, or adjusted by using the text prop. */
text: _propTypes2.default.oneOfType([_propTypes2.default.number, _propTypes2.default.string])
} : void 0;
exports.default = ButtonOr;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = undefined;
var _Button = require('./Button');
var _Button2 = _interopRequireDefault(_Button);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = _Button2.default;
|
| File | Statements | Branches | Functions | Lines | |||||
|---|---|---|---|---|---|---|---|---|---|
| Container.js | 77.27% | (17 / 22) | 83.33% | (5 / 6) | 50% | (1 / 2) | 76.19% | (16 / 21) | |
| index.js | 100% | (7 / 7) | 75% | (3 / 4) | 100% | (1 / 1) | 100% | (6 / 6) |
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 | 1 1 1 1 1 1 1 1 1 1 4 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* A container limits content to a maximum width.
*/
function Container(props) {
var children = props.children,
className = props.className,
fluid = props.fluid,
text = props.text,
textAlign = props.textAlign;
var classes = (0, _classnames2.default)('ui', (0, _lib.useKeyOnly)(text, 'text'), (0, _lib.useKeyOnly)(fluid, 'fluid'), (0, _lib.useTextAlignProp)(textAlign), 'container', className);
var rest = (0, _lib.getUnhandledProps)(Container, props);
var ElementType = (0, _lib.getElementType)(Container, props);
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
children
);
}
Container.handledProps = ['as', 'children', 'className', 'fluid', 'text', 'textAlign'];
Container._meta = {
name: 'Container',
type: _lib.META.TYPES.ELEMENT
};
process.env.NODE_ENV !== "production" ? Container.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string,
/** Container has no maximum with. */
fluid: _propTypes2.default.bool,
/** Reduce maximum width to more naturally accommodate text. */
text: _propTypes2.default.bool,
/** Align container text. */
textAlign: _propTypes2.default.oneOf(_lib.SUI.TEXT_ALIGNMENTS)
} : void 0;
exports.default = Container;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = undefined;
var _Container = require('./Container');
var _Container2 = _interopRequireDefault(_Container);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = _Container2.default;
|
| File | Statements | Branches | Functions | Lines | |||||
|---|---|---|---|---|---|---|---|---|---|
| Divider.js | 77.27% | (17 / 22) | 83.33% | (5 / 6) | 50% | (1 / 2) | 76.19% | (16 / 21) | |
| index.js | 100% | (7 / 7) | 75% | (3 / 4) | 100% | (1 / 1) | 100% | (6 / 6) |
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | 1 1 1 1 1 1 1 1 1 1 4 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* A divider visually segments content into groups.
*/
function Divider(props) {
var children = props.children,
className = props.className,
clearing = props.clearing,
fitted = props.fitted,
hidden = props.hidden,
horizontal = props.horizontal,
inverted = props.inverted,
section = props.section,
vertical = props.vertical;
var classes = (0, _classnames2.default)('ui', (0, _lib.useKeyOnly)(clearing, 'clearing'), (0, _lib.useKeyOnly)(fitted, 'fitted'), (0, _lib.useKeyOnly)(hidden, 'hidden'), (0, _lib.useKeyOnly)(horizontal, 'horizontal'), (0, _lib.useKeyOnly)(inverted, 'inverted'), (0, _lib.useKeyOnly)(section, 'section'), (0, _lib.useKeyOnly)(vertical, 'vertical'), 'divider', className);
var rest = (0, _lib.getUnhandledProps)(Divider, props);
var ElementType = (0, _lib.getElementType)(Divider, props);
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
children
);
}
Divider.handledProps = ['as', 'children', 'className', 'clearing', 'fitted', 'hidden', 'horizontal', 'inverted', 'section', 'vertical'];
Divider._meta = {
name: 'Divider',
type: _lib.META.TYPES.ELEMENT
};
process.env.NODE_ENV !== "production" ? Divider.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string,
/** Divider can clear the content above it. */
clearing: _propTypes2.default.bool,
/** Divider can be fitted without any space above or below it. */
fitted: _propTypes2.default.bool,
/** Divider can divide content without creating a dividing line. */
hidden: _propTypes2.default.bool,
/** Divider can segment content horizontally. */
horizontal: _propTypes2.default.bool,
/** Divider can have it's colours inverted. */
inverted: _propTypes2.default.bool,
/** Divider can provide greater margins to divide sections of content. */
section: _propTypes2.default.bool,
/** Divider can segment content vertically. */
vertical: _propTypes2.default.bool
} : void 0;
exports.default = Divider;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = undefined;
var _Divider = require('./Divider');
var _Divider2 = _interopRequireDefault(_Divider);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = _Divider2.default;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | 1 1 1 1 1 1 1 1 1 1 4 1 1 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var names = ['ad', 'andorra', 'ae', 'united arab emirates', 'uae', 'af', 'afghanistan', 'ag', 'antigua', 'ai', 'anguilla', 'al', 'albania', 'am', 'armenia', 'an', 'netherlands antilles', 'ao', 'angola', 'ar', 'argentina', 'as', 'american samoa', 'at', 'austria', 'au', 'australia', 'aw', 'aruba', 'ax', 'aland islands', 'az', 'azerbaijan', 'ba', 'bosnia', 'bb', 'barbados', 'bd', 'bangladesh', 'be', 'belgium', 'bf', 'burkina faso', 'bg', 'bulgaria', 'bh', 'bahrain', 'bi', 'burundi', 'bj', 'benin', 'bm', 'bermuda', 'bn', 'brunei', 'bo', 'bolivia', 'br', 'brazil', 'bs', 'bahamas', 'bt', 'bhutan', 'bv', 'bouvet island', 'bw', 'botswana', 'by', 'belarus', 'bz', 'belize', 'ca', 'canada', 'cc', 'cocos islands', 'cd', 'congo', 'cf', 'central african republic', 'cg', 'congo brazzaville', 'ch', 'switzerland', 'ci', 'cote divoire', 'ck', 'cook islands', 'cl', 'chile', 'cm', 'cameroon', 'cn', 'china', 'co', 'colombia', 'cr', 'costa rica', 'cs', 'cu', 'cuba', 'cv', 'cape verde', 'cx', 'christmas island', 'cy', 'cyprus', 'cz', 'czech republic', 'de', 'germany', 'dj', 'djibouti', 'dk', 'denmark', 'dm', 'dominica', 'do', 'dominican republic', 'dz', 'algeria', 'ec', 'ecuador', 'ee', 'estonia', 'eg', 'egypt', 'eh', 'western sahara', 'er', 'eritrea', 'es', 'spain', 'et', 'ethiopia', 'eu', 'european union', 'fi', 'finland', 'fj', 'fiji', 'fk', 'falkland islands', 'fm', 'micronesia', 'fo', 'faroe islands', 'fr', 'france', 'ga', 'gabon', 'gb', 'united kingdom', 'gd', 'grenada', 'ge', 'georgia', 'gf', 'french guiana', 'gh', 'ghana', 'gi', 'gibraltar', 'gl', 'greenland', 'gm', 'gambia', 'gn', 'guinea', 'gp', 'guadeloupe', 'gq', 'equatorial guinea', 'gr', 'greece', 'gs', 'sandwich islands', 'gt', 'guatemala', 'gu', 'guam', 'gw', 'guinea-bissau', 'gy', 'guyana', 'hk', 'hong kong', 'hm', 'heard island', 'hn', 'honduras', 'hr', 'croatia', 'ht', 'haiti', 'hu', 'hungary', 'id', 'indonesia', 'ie', 'ireland', 'il', 'israel', 'in', 'india', 'io', 'indian ocean territory', 'iq', 'iraq', 'ir', 'iran', 'is', 'iceland', 'it', 'italy', 'jm', 'jamaica', 'jo', 'jordan', 'jp', 'japan', 'ke', 'kenya', 'kg', 'kyrgyzstan', 'kh', 'cambodia', 'ki', 'kiribati', 'km', 'comoros', 'kn', 'saint kitts and nevis', 'kp', 'north korea', 'kr', 'south korea', 'kw', 'kuwait', 'ky', 'cayman islands', 'kz', 'kazakhstan', 'la', 'laos', 'lb', 'lebanon', 'lc', 'saint lucia', 'li', 'liechtenstein', 'lk', 'sri lanka', 'lr', 'liberia', 'ls', 'lesotho', 'lt', 'lithuania', 'lu', 'luxembourg', 'lv', 'latvia', 'ly', 'libya', 'ma', 'morocco', 'mc', 'monaco', 'md', 'moldova', 'me', 'montenegro', 'mg', 'madagascar', 'mh', 'marshall islands', 'mk', 'macedonia', 'ml', 'mali', 'mm', 'myanmar', 'burma', 'mn', 'mongolia', 'mo', 'macau', 'mp', 'northern mariana islands', 'mq', 'martinique', 'mr', 'mauritania', 'ms', 'montserrat', 'mt', 'malta', 'mu', 'mauritius', 'mv', 'maldives', 'mw', 'malawi', 'mx', 'mexico', 'my', 'malaysia', 'mz', 'mozambique', 'na', 'namibia', 'nc', 'new caledonia', 'ne', 'niger', 'nf', 'norfolk island', 'ng', 'nigeria', 'ni', 'nicaragua', 'nl', 'netherlands', 'no', 'norway', 'np', 'nepal', 'nr', 'nauru', 'nu', 'niue', 'nz', 'new zealand', 'om', 'oman', 'pa', 'panama', 'pe', 'peru', 'pf', 'french polynesia', 'pg', 'new guinea', 'ph', 'philippines', 'pk', 'pakistan', 'pl', 'poland', 'pm', 'saint pierre', 'pn', 'pitcairn islands', 'pr', 'puerto rico', 'ps', 'palestine', 'pt', 'portugal', 'pw', 'palau', 'py', 'paraguay', 'qa', 'qatar', 're', 'reunion', 'ro', 'romania', 'rs', 'serbia', 'ru', 'russia', 'rw', 'rwanda', 'sa', 'saudi arabia', 'sb', 'solomon islands', 'sc', 'seychelles', 'gb sct', 'scotland', 'sd', 'sudan', 'se', 'sweden', 'sg', 'singapore', 'sh', 'saint helena', 'si', 'slovenia', 'sj', 'svalbard', 'jan mayen', 'sk', 'slovakia', 'sl', 'sierra leone', 'sm', 'san marino', 'sn', 'senegal', 'so', 'somalia', 'sr', 'suriname', 'st', 'sao tome', 'sv', 'el salvador', 'sy', 'syria', 'sz', 'swaziland', 'tc', 'caicos islands', 'td', 'chad', 'tf', 'french territories', 'tg', 'togo', 'th', 'thailand', 'tj', 'tajikistan', 'tk', 'tokelau', 'tl', 'timorleste', 'tm', 'turkmenistan', 'tn', 'tunisia', 'to', 'tonga', 'tr', 'turkey', 'tt', 'trinidad', 'tv', 'tuvalu', 'tw', 'taiwan', 'tz', 'tanzania', 'ua', 'ukraine', 'ug', 'uganda', 'um', 'us minor islands', 'us', 'america', 'united states', 'uy', 'uruguay', 'uz', 'uzbekistan', 'va', 'vatican city', 'vc', 'saint vincent', 've', 'venezuela', 'vg', 'british virgin islands', 'vi', 'us virgin islands', 'vn', 'vietnam', 'vu', 'vanuatu', 'gb wls', 'wales', 'wf', 'wallis and futuna', 'ws', 'samoa', 'ye', 'yemen', 'yt', 'mayotte', 'za', 'south africa', 'zm', 'zambia', 'zw', 'zimbabwe'];
/**
* A flag is is used to represent a political state.
*/
function Flag(props) {
var className = props.className,
name = props.name;
var classes = (0, _classnames2.default)(name, 'flag', className);
var rest = (0, _lib.getUnhandledProps)(Flag, props);
var ElementType = (0, _lib.getElementType)(Flag, props);
return _react2.default.createElement(ElementType, (0, _extends3.default)({}, rest, { className: classes }));
}
Flag.handledProps = ['as', 'className', 'name'];
Flag._meta = {
name: 'Flag',
type: _lib.META.TYPES.ELEMENT
};
process.env.NODE_ENV !== "production" ? Flag.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Additional classes. */
className: _propTypes2.default.string,
/** Flag name, can use the two digit country code, the full name, or a common alias. */
name: _lib.customPropTypes.suggest(names)
} : void 0;
Flag.defaultProps = {
as: 'i'
};
Flag.create = (0, _lib.createShorthandFactory)(Flag, function (value) {
return { name: value };
});
exports.default = Flag;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = undefined;
var _Flag = require('./Flag');
var _Flag2 = _interopRequireDefault(_Flag);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = _Flag2.default;
|
| File | Statements | Branches | Functions | Lines | |||||
|---|---|---|---|---|---|---|---|---|---|
| Header.js | 72.09% | (31 / 43) | 29.41% | (5 / 17) | 50% | (1 / 2) | 71.43% | (30 / 42) | |
| HeaderContent.js | 77.27% | (17 / 22) | 83.33% | (5 / 6) | 50% | (1 / 2) | 76.19% | (16 / 21) | |
| HeaderSubheader.js | 76.92% | (20 / 26) | 62.5% | (5 / 8) | 33.33% | (1 / 3) | 76% | (19 / 25) | |
| index.js | 100% | (7 / 7) | 75% | (3 / 4) | 100% | (1 / 1) | 100% | (6 / 6) |
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 | 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 10 1 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _without2 = require('lodash/without');
var _without3 = _interopRequireDefault(_without2);
var _isNil2 = require('lodash/isNil');
var _isNil3 = _interopRequireDefault(_isNil2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
var _Icon = require('../../elements/Icon');
var _Icon2 = _interopRequireDefault(_Icon);
var _Image = require('../../elements/Image');
var _Image2 = _interopRequireDefault(_Image);
var _HeaderSubheader = require('./HeaderSubheader');
var _HeaderSubheader2 = _interopRequireDefault(_HeaderSubheader);
var _HeaderContent = require('./HeaderContent');
var _HeaderContent2 = _interopRequireDefault(_HeaderContent);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* A header provides a short summary of content
*/
function Header(props) {
var attached = props.attached,
block = props.block,
children = props.children,
className = props.className,
color = props.color,
content = props.content,
disabled = props.disabled,
dividing = props.dividing,
floated = props.floated,
icon = props.icon,
image = props.image,
inverted = props.inverted,
size = props.size,
sub = props.sub,
subheader = props.subheader,
textAlign = props.textAlign;
var classes = (0, _classnames2.default)('ui', color, size, (0, _lib.useKeyOnly)(block, 'block'), (0, _lib.useKeyOnly)(disabled, 'disabled'), (0, _lib.useKeyOnly)(dividing, 'dividing'), (0, _lib.useValueAndKey)(floated, 'floated'), (0, _lib.useKeyOnly)(icon === true, 'icon'), (0, _lib.useKeyOnly)(image === true, 'image'), (0, _lib.useKeyOnly)(inverted, 'inverted'), (0, _lib.useKeyOnly)(sub, 'sub'), (0, _lib.useKeyOrValueAndKey)(attached, 'attached'), (0, _lib.useTextAlignProp)(textAlign), 'header', className);
var rest = (0, _lib.getUnhandledProps)(Header, props);
var ElementType = (0, _lib.getElementType)(Header, props);
if (!(0, _isNil3.default)(children)) {
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
children
);
}
var iconElement = _Icon2.default.create(icon);
var imageElement = _Image2.default.create(image);
var subheaderElement = _HeaderSubheader2.default.create(subheader);
if (iconElement || imageElement) {
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
iconElement || imageElement,
(content || subheaderElement) && _react2.default.createElement(
_HeaderContent2.default,
null,
content,
subheaderElement
)
);
}
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
content,
subheaderElement
);
}
Header.handledProps = ['as', 'attached', 'block', 'children', 'className', 'color', 'content', 'disabled', 'dividing', 'floated', 'icon', 'image', 'inverted', 'size', 'sub', 'subheader', 'textAlign'];
Header._meta = {
name: 'Header',
type: _lib.META.TYPES.ELEMENT
};
process.env.NODE_ENV !== "production" ? Header.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Attach header to other content, like a segment. */
attached: _propTypes2.default.oneOfType([_propTypes2.default.bool, _propTypes2.default.oneOf(['top', 'bottom'])]),
/** Format header to appear inside a content block. */
block: _propTypes2.default.bool,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string,
/** Color of the header. */
color: _propTypes2.default.oneOf(_lib.SUI.COLORS),
/** Shorthand for primary content. */
content: _lib.customPropTypes.contentShorthand,
/** Show that the header is inactive. */
disabled: _propTypes2.default.bool,
/** Divide header from the content below it. */
dividing: _propTypes2.default.bool,
/** Header can sit to the left or right of other content. */
floated: _propTypes2.default.oneOf(_lib.SUI.FLOATS),
/** Add an icon by icon name or pass an Icon. */
icon: _lib.customPropTypes.every([_lib.customPropTypes.disallow(['image']), _propTypes2.default.oneOfType([_propTypes2.default.bool, _lib.customPropTypes.itemShorthand])]),
/** Add an image by img src or pass an Image. */
image: _lib.customPropTypes.every([_lib.customPropTypes.disallow(['icon']), _propTypes2.default.oneOfType([_propTypes2.default.bool, _lib.customPropTypes.itemShorthand])]),
/** Inverts the color of the header for dark backgrounds. */
inverted: _propTypes2.default.bool,
/** Content headings are sized with em and are based on the font-size of their container. */
size: _propTypes2.default.oneOf((0, _without3.default)(_lib.SUI.SIZES, 'big', 'massive')),
/** Headers may be formatted to label smaller or de-emphasized content. */
sub: _propTypes2.default.bool,
/** Shorthand for Header.Subheader. */
subheader: _lib.customPropTypes.itemShorthand,
/** Align header content. */
textAlign: _propTypes2.default.oneOf(_lib.SUI.TEXT_ALIGNMENTS)
} : void 0;
Header.Content = _HeaderContent2.default;
Header.Subheader = _HeaderSubheader2.default;
exports.default = Header;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | 1 1 1 1 1 1 1 1 1 1 4 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* Header content wraps the main content when there is an adjacent Icon or Image.
*/
function HeaderContent(props) {
var children = props.children,
className = props.className;
var classes = (0, _classnames2.default)('content', className);
var rest = (0, _lib.getUnhandledProps)(HeaderContent, props);
var ElementType = (0, _lib.getElementType)(HeaderContent, props);
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
children
);
}
HeaderContent.handledProps = ['as', 'children', 'className'];
HeaderContent._meta = {
name: 'HeaderContent',
parent: 'Header',
type: _lib.META.TYPES.VIEW
};
process.env.NODE_ENV !== "production" ? HeaderContent.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string
} : void 0;
exports.default = HeaderContent;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | 1 1 1 1 1 1 1 1 1 1 1 1 5 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _isNil2 = require('lodash/isNil');
var _isNil3 = _interopRequireDefault(_isNil2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* Headers may contain subheaders.
*/
function HeaderSubheader(props) {
var children = props.children,
className = props.className,
content = props.content;
var classes = (0, _classnames2.default)('sub header', className);
var rest = (0, _lib.getUnhandledProps)(HeaderSubheader, props);
var ElementType = (0, _lib.getElementType)(HeaderSubheader, props);
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
(0, _isNil3.default)(children) ? content : children
);
}
HeaderSubheader.handledProps = ['as', 'children', 'className', 'content'];
HeaderSubheader._meta = {
name: 'HeaderSubheader',
parent: 'Header',
type: _lib.META.TYPES.ELEMENT
};
process.env.NODE_ENV !== "production" ? HeaderSubheader.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string,
/** Shorthand for primary content. */
content: _lib.customPropTypes.contentShorthand
} : void 0;
HeaderSubheader.create = (0, _lib.createShorthandFactory)(HeaderSubheader, function (content) {
return { content: content };
});
exports.default = HeaderSubheader;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = undefined;
var _Header = require('./Header');
var _Header2 = _interopRequireDefault(_Header);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = _Header2.default;
|
| File | Statements | Branches | Functions | Lines | |||||
|---|---|---|---|---|---|---|---|---|---|
| Icon.js | 80% | (24 / 30) | 83.33% | (5 / 6) | 33.33% | (1 / 3) | 79.31% | (23 / 29) | |
| IconGroup.js | 80% | (20 / 25) | 83.33% | (5 / 6) | 50% | (1 / 2) | 79.17% | (19 / 24) | |
| index.js | 100% | (7 / 7) | 75% | (3 / 4) | 100% | (1 / 1) | 100% | (6 / 6) |
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 | 1 1 1 1 1 1 1 1 1 1 1 1 1 1 6 1 1 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _without2 = require('lodash/without');
var _without3 = _interopRequireDefault(_without2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
var _IconGroup = require('./IconGroup');
var _IconGroup2 = _interopRequireDefault(_IconGroup);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* An icon is a glyph used to represent something else.
* @see Image
*/
function Icon(props) {
var bordered = props.bordered,
circular = props.circular,
className = props.className,
color = props.color,
corner = props.corner,
disabled = props.disabled,
fitted = props.fitted,
flipped = props.flipped,
inverted = props.inverted,
link = props.link,
loading = props.loading,
name = props.name,
rotated = props.rotated,
size = props.size;
var classes = (0, _classnames2.default)(color, name, size, (0, _lib.useKeyOnly)(bordered, 'bordered'), (0, _lib.useKeyOnly)(circular, 'circular'), (0, _lib.useKeyOnly)(corner, 'corner'), (0, _lib.useKeyOnly)(disabled, 'disabled'), (0, _lib.useKeyOnly)(fitted, 'fitted'), (0, _lib.useKeyOnly)(inverted, 'inverted'), (0, _lib.useKeyOnly)(link, 'link'), (0, _lib.useKeyOnly)(loading, 'loading'), (0, _lib.useValueAndKey)(flipped, 'flipped'), (0, _lib.useValueAndKey)(rotated, 'rotated'), 'icon', className);
var rest = (0, _lib.getUnhandledProps)(Icon, props);
var ElementType = (0, _lib.getElementType)(Icon, props);
return _react2.default.createElement(ElementType, (0, _extends3.default)({}, rest, { 'aria-hidden': 'true', className: classes }));
}
Icon.handledProps = ['as', 'bordered', 'circular', 'className', 'color', 'corner', 'disabled', 'fitted', 'flipped', 'inverted', 'link', 'loading', 'name', 'rotated', 'size'];
Icon.Group = _IconGroup2.default;
Icon._meta = {
name: 'Icon',
type: _lib.META.TYPES.ELEMENT
};
process.env.NODE_ENV !== "production" ? Icon.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Formatted to appear bordered. */
bordered: _propTypes2.default.bool,
/** Icon can formatted to appear circular. */
circular: _propTypes2.default.bool,
/** Additional classes. */
className: _propTypes2.default.string,
/** Color of the icon. */
color: _propTypes2.default.oneOf(_lib.SUI.COLORS),
/** Icons can display a smaller corner icon. */
corner: _propTypes2.default.bool,
/** Show that the icon is inactive. */
disabled: _propTypes2.default.bool,
/** Fitted, without space to left or right of Icon. */
fitted: _propTypes2.default.bool,
/** Icon can flipped. */
flipped: _propTypes2.default.oneOf(['horizontally', 'vertically']),
/** Formatted to have its colors inverted for contrast. */
inverted: _propTypes2.default.bool,
/** Icon can be formatted as a link. */
link: _propTypes2.default.bool,
/** Icon can be used as a simple loader. */
loading: _propTypes2.default.bool,
/** Name of the icon. */
name: _lib.customPropTypes.suggest(_lib.SUI.ALL_ICONS_IN_ALL_CONTEXTS),
/** Icon can rotated. */
rotated: _propTypes2.default.oneOf(['clockwise', 'counterclockwise']),
/** Size of the icon. */
size: _propTypes2.default.oneOf((0, _without3.default)(_lib.SUI.SIZES, 'medium'))
} : void 0;
Icon.defaultProps = {
as: 'i'
};
Icon.create = (0, _lib.createShorthandFactory)(Icon, function (value) {
return { name: value };
});
exports.default = Icon;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | 1 1 1 1 1 1 1 1 1 1 1 1 5 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _without2 = require('lodash/without');
var _without3 = _interopRequireDefault(_without2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* Several icons can be used together as a group.
*/
function IconGroup(props) {
var children = props.children,
className = props.className,
size = props.size;
var classes = (0, _classnames2.default)(size, 'icons', className);
var rest = (0, _lib.getUnhandledProps)(IconGroup, props);
var ElementType = (0, _lib.getElementType)(IconGroup, props);
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
children
);
}
IconGroup.handledProps = ['as', 'children', 'className', 'size'];
IconGroup._meta = {
name: 'IconGroup',
parent: 'Icon',
type: _lib.META.TYPES.ELEMENT
};
process.env.NODE_ENV !== "production" ? IconGroup.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string,
/** Size of the icon group. */
size: _propTypes2.default.oneOf((0, _without3.default)(_lib.SUI.SIZES, 'medium'))
} : void 0;
IconGroup.defaultProps = {
as: 'i'
};
exports.default = IconGroup;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = undefined;
var _Icon = require('./Icon');
var _Icon2 = _interopRequireDefault(_Icon);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = _Icon2.default;
|
| File | Statements | Branches | Functions | Lines | |||||
|---|---|---|---|---|---|---|---|---|---|
| Image.js | 66.67% | (28 / 42) | 31.25% | (5 / 16) | 25% | (1 / 4) | 69.23% | (27 / 39) | |
| ImageGroup.js | 77.27% | (17 / 22) | 83.33% | (5 / 6) | 50% | (1 / 2) | 76.19% | (16 / 21) | |
| index.js | 100% | (7 / 7) | 75% | (3 / 4) | 100% | (1 / 1) | 100% | (6 / 6) |
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 | 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 8 1 1 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _isNil2 = require('lodash/isNil');
var _isNil3 = _interopRequireDefault(_isNil2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
var _Dimmer = require('../../modules/Dimmer');
var _Dimmer2 = _interopRequireDefault(_Dimmer);
var _Label = require('../Label/Label');
var _Label2 = _interopRequireDefault(_Label);
var _ImageGroup = require('./ImageGroup');
var _ImageGroup2 = _interopRequireDefault(_ImageGroup);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* An image is a graphic representation of something.
* @see Icon
*/
function Image(props) {
var alt = props.alt,
avatar = props.avatar,
bordered = props.bordered,
centered = props.centered,
children = props.children,
className = props.className,
dimmer = props.dimmer,
disabled = props.disabled,
floated = props.floated,
fluid = props.fluid,
height = props.height,
hidden = props.hidden,
href = props.href,
inline = props.inline,
label = props.label,
shape = props.shape,
size = props.size,
spaced = props.spaced,
src = props.src,
verticalAlign = props.verticalAlign,
width = props.width,
wrapped = props.wrapped,
ui = props.ui;
var classes = (0, _classnames2.default)((0, _lib.useKeyOnly)(ui, 'ui'), size, shape, (0, _lib.useKeyOnly)(avatar, 'avatar'), (0, _lib.useKeyOnly)(bordered, 'bordered'), (0, _lib.useKeyOnly)(centered, 'centered'), (0, _lib.useKeyOnly)(disabled, 'disabled'), (0, _lib.useKeyOnly)(fluid, 'fluid'), (0, _lib.useKeyOnly)(hidden, 'hidden'), (0, _lib.useKeyOnly)(inline, 'inline'), (0, _lib.useKeyOrValueAndKey)(spaced, 'spaced'), (0, _lib.useValueAndKey)(floated, 'floated'), (0, _lib.useVerticalAlignProp)(verticalAlign, 'aligned'), 'image', className);
var rest = (0, _lib.getUnhandledProps)(Image, props);
var ElementType = (0, _lib.getElementType)(Image, props, function () {
if (!(0, _isNil3.default)(dimmer) || !(0, _isNil3.default)(label) || !(0, _isNil3.default)(wrapped) || !(0, _isNil3.default)(children)) return 'div';
});
if (!(0, _isNil3.default)(children)) {
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
children
);
}
var rootProps = (0, _extends3.default)({}, rest, { className: classes });
var imgTagProps = { alt: alt, src: src, height: height, width: width };
if (ElementType === 'img') return _react2.default.createElement(ElementType, (0, _extends3.default)({}, rootProps, imgTagProps));
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rootProps, { href: href }),
_Dimmer2.default.create(dimmer),
_Label2.default.create(label),
_react2.default.createElement('img', imgTagProps)
);
}
Image.handledProps = ['alt', 'as', 'avatar', 'bordered', 'centered', 'children', 'className', 'dimmer', 'disabled', 'floated', 'fluid', 'height', 'hidden', 'href', 'inline', 'label', 'shape', 'size', 'spaced', 'src', 'ui', 'verticalAlign', 'width', 'wrapped'];
Image.Group = _ImageGroup2.default;
Image._meta = {
name: 'Image',
type: _lib.META.TYPES.ELEMENT
};
process.env.NODE_ENV !== "production" ? Image.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Alternate text for the image specified. */
alt: _propTypes2.default.string,
/** An image may be formatted to appear inline with text as an avatar. */
avatar: _propTypes2.default.bool,
/** An image may include a border to emphasize the edges of white or transparent content. */
bordered: _propTypes2.default.bool,
/** An image can appear centered in a content block. */
centered: _propTypes2.default.bool,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string,
/** An image can show that it is disabled and cannot be selected. */
disabled: _propTypes2.default.bool,
/** Shorthand for Dimmer. */
dimmer: _lib.customPropTypes.itemShorthand,
/** An image can sit to the left or right of other content. */
floated: _propTypes2.default.oneOf(_lib.SUI.FLOATS),
/** An image can take up the width of its container. */
fluid: _lib.customPropTypes.every([_propTypes2.default.bool, _lib.customPropTypes.disallow(['size'])]),
/** The img element height attribute. */
height: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.number]),
/** An image can be hidden. */
hidden: _propTypes2.default.bool,
/** Renders the Image as an <a> tag with this href. */
href: _propTypes2.default.string,
/** An image may appear inline. */
inline: _propTypes2.default.bool,
/** Shorthand for Label. */
label: _lib.customPropTypes.itemShorthand,
/** An image may appear rounded or circular. */
shape: _propTypes2.default.oneOf(['rounded', 'circular']),
/** An image may appear at different sizes. */
size: _propTypes2.default.oneOf(_lib.SUI.SIZES),
/** An image can specify that it needs an additional spacing to separate it from nearby content. */
spaced: _propTypes2.default.oneOfType([_propTypes2.default.bool, _propTypes2.default.oneOf(['left', 'right'])]),
/** Specifies the URL of the image. */
src: _propTypes2.default.string,
/** Whether or not to add the ui className. */
ui: _propTypes2.default.bool,
/** An image can specify its vertical alignment. */
verticalAlign: _propTypes2.default.oneOf(_lib.SUI.VERTICAL_ALIGNMENTS),
/** The img element width attribute. */
width: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.number]),
/** An image can render wrapped in a `div.ui.image` as alternative HTML markup. */
wrapped: _lib.customPropTypes.every([_propTypes2.default.bool,
// these props wrap the image in an a tag already
_lib.customPropTypes.disallow(['href'])])
} : void 0;
Image.defaultProps = {
as: 'img',
ui: true
};
Image.create = (0, _lib.createShorthandFactory)(Image, function (value) {
return { src: value };
});
exports.default = Image;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | 1 1 1 1 1 1 1 1 1 1 4 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* A group of images.
*/
function ImageGroup(props) {
var children = props.children,
className = props.className,
size = props.size;
var classes = (0, _classnames2.default)('ui', size, className, 'images');
var rest = (0, _lib.getUnhandledProps)(ImageGroup, props);
var ElementType = (0, _lib.getElementType)(ImageGroup, props);
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
children
);
}
ImageGroup.handledProps = ['as', 'children', 'className', 'size'];
ImageGroup._meta = {
name: 'ImageGroup',
parent: 'Image',
type: _lib.META.TYPES.ELEMENT
};
process.env.NODE_ENV !== "production" ? ImageGroup.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string,
/** A group of images can be formatted to have the same size. */
size: _propTypes2.default.oneOf(_lib.SUI.SIZES)
} : void 0;
exports.default = ImageGroup;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = undefined;
var _Image = require('./Image');
var _Image2 = _interopRequireDefault(_Image);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = _Image2.default;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 | 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 17 1 1 1 1 1 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _slicedToArray2 = require('babel-runtime/helpers/slicedToArray');
var _slicedToArray3 = _interopRequireDefault(_slicedToArray2);
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
var _createClass2 = require('babel-runtime/helpers/createClass');
var _createClass3 = _interopRequireDefault(_createClass2);
var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
var _inherits2 = require('babel-runtime/helpers/inherits');
var _inherits3 = _interopRequireDefault(_inherits2);
var _includes2 = require('lodash/includes');
var _includes3 = _interopRequireDefault(_includes2);
var _map2 = require('lodash/map');
var _map3 = _interopRequireDefault(_map2);
var _isNil2 = require('lodash/isNil');
var _isNil3 = _interopRequireDefault(_isNil2);
var _invoke2 = require('lodash/invoke');
var _invoke3 = _interopRequireDefault(_invoke2);
var _get2 = require('lodash/get');
var _get3 = _interopRequireDefault(_get2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
var _Button = require('../../elements/Button');
var _Button2 = _interopRequireDefault(_Button);
var _Icon = require('../../elements/Icon');
var _Icon2 = _interopRequireDefault(_Icon);
var _Label = require('../../elements/Label');
var _Label2 = _interopRequireDefault(_Label);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* An Input is a field used to elicit a response from a user.
* @see Button
* @see Form
* @see Icon
* @see Label
*/
var Input = function (_Component) {
(0, _inherits3.default)(Input, _Component);
function Input() {
var _ref;
var _temp, _this, _ret;
(0, _classCallCheck3.default)(this, Input);
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return _ret = (_temp = (_this = (0, _possibleConstructorReturn3.default)(this, (_ref = Input.__proto__ || Object.getPrototypeOf(Input)).call.apply(_ref, [this].concat(args))), _this), _this.focus = function () {
return _this.inputRef.focus();
}, _this.handleChange = function (e) {
var onChange = _this.props.onChange;
var value = (0, _get3.default)(e, 'target.value');
onChange(e, (0, _extends3.default)({}, _this.props, { value: value }));
}, _this.handleChildOverrides = function (child, defaultProps) {
return (0, _extends3.default)({}, defaultProps, child.props, {
ref: function ref(c) {
(0, _invoke3.default)(child, 'ref', c);
_this.handleInputRef(c);
}
});
}, _this.handleInputRef = function (c) {
return _this.inputRef = c;
}, _temp), (0, _possibleConstructorReturn3.default)(_this, _ret);
}
(0, _createClass3.default)(Input, [{
key: 'render',
value: function render() {
var _this2 = this;
var _props = this.props,
action = _props.action,
actionPosition = _props.actionPosition,
children = _props.children,
className = _props.className,
disabled = _props.disabled,
error = _props.error,
fluid = _props.fluid,
focus = _props.focus,
icon = _props.icon,
iconPosition = _props.iconPosition,
input = _props.input,
inverted = _props.inverted,
label = _props.label,
labelPosition = _props.labelPosition,
loading = _props.loading,
onChange = _props.onChange,
size = _props.size,
tabIndex = _props.tabIndex,
transparent = _props.transparent,
type = _props.type;
var classes = (0, _classnames2.default)('ui', size, (0, _lib.useKeyOnly)(disabled, 'disabled'), (0, _lib.useKeyOnly)(error, 'error'), (0, _lib.useKeyOnly)(fluid, 'fluid'), (0, _lib.useKeyOnly)(focus, 'focus'), (0, _lib.useKeyOnly)(inverted, 'inverted'), (0, _lib.useKeyOnly)(loading, 'loading'), (0, _lib.useKeyOnly)(transparent, 'transparent'), (0, _lib.useValueAndKey)(actionPosition, 'action') || (0, _lib.useKeyOnly)(action, 'action'), (0, _lib.useValueAndKey)(iconPosition, 'icon') || (0, _lib.useKeyOnly)(icon, 'icon'), (0, _lib.useValueAndKey)(labelPosition, 'labeled') || (0, _lib.useKeyOnly)(label, 'labeled'), 'input', className);
var unhandled = (0, _lib.getUnhandledProps)(Input, this.props);
var ElementType = (0, _lib.getElementType)(Input, this.props);
// Heads up! We should pass `type` prop manually because `Input` component handles it
var _partitionHTMLInputPr = (0, _lib.partitionHTMLInputProps)((0, _extends3.default)({}, unhandled, { type: type })),
_partitionHTMLInputPr2 = (0, _slicedToArray3.default)(_partitionHTMLInputPr, 2),
htmlInputProps = _partitionHTMLInputPr2[0],
rest = _partitionHTMLInputPr2[1];
if (onChange) htmlInputProps.onChange = this.handleChange;
htmlInputProps.ref = this.handleInputRef;
// tabIndex
if (!(0, _isNil3.default)(tabIndex)) htmlInputProps.tabIndex = tabIndex;else if (disabled) htmlInputProps.tabIndex = -1;
// Render with children
// ----------------------------------------
if (!(0, _isNil3.default)(children)) {
// add htmlInputProps to the `<input />` child
var childElements = (0, _map3.default)(_react.Children.toArray(children), function (child) {
if (child.type !== 'input') return child;
return (0, _react.cloneElement)(child, _this2.handleChildOverrides(child, htmlInputProps));
});
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
childElements
);
}
// Render Shorthand
// ----------------------------------------
var actionElement = _Button2.default.create(action, { defaultProps: { className: 'button' } });
var iconElement = _Icon2.default.create(icon);
var labelElement = _Label2.default.create(label, { defaultProps: {
className: (0, _classnames2.default)('label',
// add 'left|right corner'
(0, _includes3.default)(labelPosition, 'corner') && labelPosition)
} });
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
actionPosition === 'left' && actionElement,
iconPosition === 'left' && iconElement,
labelPosition !== 'right' && labelElement,
(0, _lib.createHTMLInput)(input || type, { defaultProps: htmlInputProps }),
actionPosition !== 'left' && actionElement,
iconPosition !== 'left' && iconElement,
labelPosition === 'right' && labelElement
);
}
}]);
return Input;
}(_react.Component);
Input.defaultProps = {
type: 'text'
};
Input._meta = {
name: 'Input',
type: _lib.META.TYPES.ELEMENT
};
process.env.NODE_ENV !== "production" ? Input.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** An Input can be formatted to alert the user to an action they may perform. */
action: _propTypes2.default.oneOfType([_propTypes2.default.bool, _lib.customPropTypes.itemShorthand]),
/** An action can appear along side an Input on the left or right. */
actionPosition: _propTypes2.default.oneOf(['left']),
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string,
/** An Input field can show that it is disabled. */
disabled: _propTypes2.default.bool,
/** An Input field can show the data contains errors. */
error: _propTypes2.default.bool,
/** Take on the size of it's container. */
fluid: _propTypes2.default.bool,
/** An Input field can show a user is currently interacting with it. */
focus: _propTypes2.default.bool,
/** Optional Icon to display inside the Input. */
icon: _propTypes2.default.oneOfType([_propTypes2.default.bool, _lib.customPropTypes.itemShorthand]),
/** An Icon can appear inside an Input on the left or right. */
iconPosition: _propTypes2.default.oneOf(['left']),
/** Shorthand for creating the HTML Input. */
input: _lib.customPropTypes.itemShorthand,
/** Format to appear on dark backgrounds. */
inverted: _propTypes2.default.bool,
/** Optional Label to display along side the Input. */
label: _lib.customPropTypes.itemShorthand,
/** A Label can appear outside an Input on the left or right. */
labelPosition: _propTypes2.default.oneOf(['left', 'right', 'left corner', 'right corner']),
/** An Icon Input field can show that it is currently loading data. */
loading: _propTypes2.default.bool,
/**
* Called on change.
*
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {object} data - All props and proposed value.
*/
onChange: _propTypes2.default.func,
/** An Input can vary in size. */
size: _propTypes2.default.oneOf(_lib.SUI.SIZES),
/** An Input can receive focus. */
tabIndex: _propTypes2.default.oneOfType([_propTypes2.default.number, _propTypes2.default.string]),
/** Transparent Input has no background. */
transparent: _propTypes2.default.bool,
/** The HTML input type. */
type: _propTypes2.default.string
} : void 0;
Input.handledProps = ['action', 'actionPosition', 'as', 'children', 'className', 'disabled', 'error', 'fluid', 'focus', 'icon', 'iconPosition', 'input', 'inverted', 'label', 'labelPosition', 'loading', 'onChange', 'size', 'tabIndex', 'transparent', 'type'];
Input.create = (0, _lib.createShorthandFactory)(Input, function (type) {
return { type: type };
});
exports.default = Input;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = undefined;
var _Input = require('./Input');
var _Input2 = _interopRequireDefault(_Input);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = _Input2.default;
|
| File | Statements | Branches | Functions | Lines | |||||
|---|---|---|---|---|---|---|---|---|---|
| Label.js | 66.67% | (46 / 69) | 19.23% | (5 / 26) | 22.22% | (2 / 9) | 67.16% | (45 / 67) | |
| LabelDetail.js | 79.17% | (19 / 24) | 62.5% | (5 / 8) | 50% | (1 / 2) | 78.26% | (18 / 23) | |
| LabelGroup.js | 77.27% | (17 / 22) | 83.33% | (5 / 6) | 50% | (1 / 2) | 76.19% | (16 / 21) | |
| index.js | 100% | (7 / 7) | 75% | (3 / 4) | 100% | (1 / 1) | 100% | (6 / 6) |
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 | 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 15 1 1 1 1 1 1 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
var _createClass2 = require('babel-runtime/helpers/createClass');
var _createClass3 = _interopRequireDefault(_createClass2);
var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
var _inherits2 = require('babel-runtime/helpers/inherits');
var _inherits3 = _interopRequireDefault(_inherits2);
var _isUndefined2 = require('lodash/isUndefined');
var _isUndefined3 = _interopRequireDefault(_isUndefined2);
var _isNil2 = require('lodash/isNil');
var _isNil3 = _interopRequireDefault(_isNil2);
var _invoke2 = require('lodash/invoke');
var _invoke3 = _interopRequireDefault(_invoke2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
var _Icon = require('../Icon/Icon');
var _Icon2 = _interopRequireDefault(_Icon);
var _Image = require('../Image/Image');
var _Image2 = _interopRequireDefault(_Image);
var _LabelDetail = require('./LabelDetail');
var _LabelDetail2 = _interopRequireDefault(_LabelDetail);
var _LabelGroup = require('./LabelGroup');
var _LabelGroup2 = _interopRequireDefault(_LabelGroup);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* A label displays content classification.
*/
var Label = function (_Component) {
(0, _inherits3.default)(Label, _Component);
function Label() {
var _ref;
var _temp, _this, _ret;
(0, _classCallCheck3.default)(this, Label);
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return _ret = (_temp = (_this = (0, _possibleConstructorReturn3.default)(this, (_ref = Label.__proto__ || Object.getPrototypeOf(Label)).call.apply(_ref, [this].concat(args))), _this), _this.handleClick = function (e) {
var onClick = _this.props.onClick;
if (onClick) onClick(e, _this.props);
}, _this.handleIconOverrides = function (predefinedProps) {
return {
onClick: function onClick(e) {
(0, _invoke3.default)(predefinedProps, 'onClick', e);
(0, _invoke3.default)(_this.props, 'onRemove', e, _this.props);
}
};
}, _temp), (0, _possibleConstructorReturn3.default)(_this, _ret);
}
(0, _createClass3.default)(Label, [{
key: 'render',
value: function render() {
var _props = this.props,
active = _props.active,
attached = _props.attached,
basic = _props.basic,
children = _props.children,
circular = _props.circular,
className = _props.className,
color = _props.color,
content = _props.content,
corner = _props.corner,
detail = _props.detail,
empty = _props.empty,
floating = _props.floating,
horizontal = _props.horizontal,
icon = _props.icon,
image = _props.image,
onRemove = _props.onRemove,
pointing = _props.pointing,
removeIcon = _props.removeIcon,
ribbon = _props.ribbon,
size = _props.size,
tag = _props.tag;
var pointingClass = pointing === true && 'pointing' || (pointing === 'left' || pointing === 'right') && pointing + ' pointing' || (pointing === 'above' || pointing === 'below') && 'pointing ' + pointing;
var classes = (0, _classnames2.default)('ui', color, pointingClass, size, (0, _lib.useKeyOnly)(active, 'active'), (0, _lib.useKeyOnly)(basic, 'basic'), (0, _lib.useKeyOnly)(circular, 'circular'), (0, _lib.useKeyOnly)(empty, 'empty'), (0, _lib.useKeyOnly)(floating, 'floating'), (0, _lib.useKeyOnly)(horizontal, 'horizontal'), (0, _lib.useKeyOnly)(image === true, 'image'), (0, _lib.useKeyOnly)(tag, 'tag'), (0, _lib.useKeyOrValueAndKey)(corner, 'corner'), (0, _lib.useKeyOrValueAndKey)(ribbon, 'ribbon'), (0, _lib.useValueAndKey)(attached, 'attached'), 'label', className);
var rest = (0, _lib.getUnhandledProps)(Label, this.props);
var ElementType = (0, _lib.getElementType)(Label, this.props);
if (!(0, _isNil3.default)(children)) {
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes, onClick: this.handleClick }),
children
);
}
var removeIconShorthand = (0, _isUndefined3.default)(removeIcon) ? 'delete' : removeIcon;
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({ className: classes, onClick: this.handleClick }, rest),
_Icon2.default.create(icon),
typeof image !== 'boolean' && _Image2.default.create(image),
content,
(0, _lib.createShorthand)(_LabelDetail2.default, function (val) {
return { content: val };
}, detail),
onRemove && _Icon2.default.create(removeIconShorthand, { overrideProps: this.handleIconOverrides })
);
}
}]);
return Label;
}(_react.Component);
Label._meta = {
name: 'Label',
type: _lib.META.TYPES.ELEMENT
};
Label.Detail = _LabelDetail2.default;
Label.Group = _LabelGroup2.default;
exports.default = Label;
process.env.NODE_ENV !== "production" ? Label.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** A label can be active. */
active: _propTypes2.default.bool,
/** A label can attach to a content segment. */
attached: _propTypes2.default.oneOf(['top', 'bottom', 'top right', 'top left', 'bottom left', 'bottom right']),
/** A label can reduce its complexity. */
basic: _propTypes2.default.bool,
/** Primary content. */
children: _propTypes2.default.node,
/** A label can be circular. */
circular: _propTypes2.default.bool,
/** Additional classes. */
className: _propTypes2.default.string,
/** Color of the label. */
color: _propTypes2.default.oneOf(_lib.SUI.COLORS),
/** Shorthand for primary content. */
content: _lib.customPropTypes.contentShorthand,
/** A label can position itself in the corner of an element. */
corner: _propTypes2.default.oneOfType([_propTypes2.default.bool, _propTypes2.default.oneOf(['left', 'right'])]),
/** Shorthand for LabelDetail. */
detail: _lib.customPropTypes.itemShorthand,
/** Formats the label as a dot. */
empty: _lib.customPropTypes.every([_propTypes2.default.bool, _lib.customPropTypes.demand(['circular'])]),
/** Float above another element in the upper right corner. */
floating: _propTypes2.default.bool,
/** A horizontal label is formatted to label content along-side it horizontally. */
horizontal: _propTypes2.default.bool,
/** Shorthand for Icon. */
icon: _lib.customPropTypes.itemShorthand,
/** A label can be formatted to emphasize an image or prop can be used as shorthand for Image. */
image: _propTypes2.default.oneOfType([_propTypes2.default.bool, _lib.customPropTypes.itemShorthand]),
/**
* Called on click.
*
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {object} data - All props.
*/
onClick: _propTypes2.default.func,
/**
* Adds an "x" icon, called when "x" is clicked.
*
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {object} data - All props.
*/
onRemove: _propTypes2.default.func,
/** A label can point to content next to it. */
pointing: _propTypes2.default.oneOfType([_propTypes2.default.bool, _propTypes2.default.oneOf(['above', 'below', 'left', 'right'])]),
/** Shorthand for Icon to appear as the last child and trigger onRemove. */
removeIcon: _lib.customPropTypes.itemShorthand,
/** A label can appear as a ribbon attaching itself to an element. */
ribbon: _propTypes2.default.oneOfType([_propTypes2.default.bool, _propTypes2.default.oneOf(['right'])]),
/** A label can have different sizes. */
size: _propTypes2.default.oneOf(_lib.SUI.SIZES),
/** A label can appear as a tag. */
tag: _propTypes2.default.bool
} : void 0;
Label.handledProps = ['active', 'as', 'attached', 'basic', 'children', 'circular', 'className', 'color', 'content', 'corner', 'detail', 'empty', 'floating', 'horizontal', 'icon', 'image', 'onClick', 'onRemove', 'pointing', 'removeIcon', 'ribbon', 'size', 'tag'];
Label.create = (0, _lib.createShorthandFactory)(Label, function (value) {
return { content: value };
});
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | 1 1 1 1 1 1 1 1 1 1 1 1 5 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _isNil2 = require('lodash/isNil');
var _isNil3 = _interopRequireDefault(_isNil2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function LabelDetail(props) {
var children = props.children,
className = props.className,
content = props.content;
var classes = (0, _classnames2.default)('detail', className);
var rest = (0, _lib.getUnhandledProps)(LabelDetail, props);
var ElementType = (0, _lib.getElementType)(LabelDetail, props);
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
(0, _isNil3.default)(children) ? content : children
);
}
LabelDetail.handledProps = ['as', 'children', 'className', 'content'];
LabelDetail._meta = {
name: 'LabelDetail',
parent: 'Label',
type: _lib.META.TYPES.ELEMENT
};
process.env.NODE_ENV !== "production" ? LabelDetail.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string,
/** Shorthand for primary content. */
content: _lib.customPropTypes.contentShorthand
} : void 0;
exports.default = LabelDetail;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | 1 1 1 1 1 1 1 1 1 1 4 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* A label can be grouped.
*/
function LabelGroup(props) {
var children = props.children,
circular = props.circular,
className = props.className,
color = props.color,
size = props.size,
tag = props.tag;
var classes = (0, _classnames2.default)('ui', color, size, (0, _lib.useKeyOnly)(circular, 'circular'), (0, _lib.useKeyOnly)(tag, 'tag'), 'labels', className);
var rest = (0, _lib.getUnhandledProps)(LabelGroup, props);
var ElementType = (0, _lib.getElementType)(LabelGroup, props);
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
children
);
}
LabelGroup.handledProps = ['as', 'children', 'circular', 'className', 'color', 'size', 'tag'];
LabelGroup._meta = {
name: 'LabelGroup',
parent: 'Label',
type: _lib.META.TYPES.ELEMENT
};
process.env.NODE_ENV !== "production" ? LabelGroup.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Primary content. */
children: _propTypes2.default.node,
/** Labels can share shapes. */
circular: _propTypes2.default.bool,
/** Additional classes. */
className: _propTypes2.default.string,
/** Label group can share colors together. */
color: _propTypes2.default.oneOf(_lib.SUI.COLORS),
/** Label group can share sizes together. */
size: _propTypes2.default.oneOf(_lib.SUI.SIZES),
/** Label group can share tag formatting. */
tag: _propTypes2.default.bool
} : void 0;
exports.default = LabelGroup;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = undefined;
var _Label = require('./Label');
var _Label2 = _interopRequireDefault(_Label);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = _Label2.default;
|
| File | Statements | Branches | Functions | Lines | |||||
|---|---|---|---|---|---|---|---|---|---|
| List.js | 74.65% | (53 / 71) | 50% | (5 / 10) | 28.57% | (2 / 7) | 74.29% | (52 / 70) | |
| ListContent.js | 75% | (24 / 32) | 62.5% | (5 / 8) | 33.33% | (1 / 3) | 76.67% | (23 / 30) | |
| ListDescription.js | 76.92% | (20 / 26) | 62.5% | (5 / 8) | 33.33% | (1 / 3) | 76% | (19 / 25) | |
| ListHeader.js | 76.92% | (20 / 26) | 62.5% | (5 / 8) | 33.33% | (1 / 3) | 76% | (19 / 25) | |
| ListIcon.js | 80% | (20 / 25) | 83.33% | (5 / 6) | 33.33% | (1 / 3) | 79.17% | (19 / 24) | |
| ListItem.js | 62.86% | (44 / 70) | 16.67% | (5 / 30) | 33.33% | (2 / 6) | 63.24% | (43 / 68) | |
| ListList.js | 77.27% | (17 / 22) | 62.5% | (5 / 8) | 50% | (1 / 2) | 76.19% | (16 / 21) | |
| index.js | 100% | (7 / 7) | 75% | (3 / 4) | 100% | (1 / 1) | 100% | (6 / 6) |
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 | 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 17 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
var _createClass2 = require('babel-runtime/helpers/createClass');
var _createClass3 = _interopRequireDefault(_createClass2);
var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
var _inherits2 = require('babel-runtime/helpers/inherits');
var _inherits3 = _interopRequireDefault(_inherits2);
var _map2 = require('lodash/map');
var _map3 = _interopRequireDefault(_map2);
var _isNil2 = require('lodash/isNil');
var _isNil3 = _interopRequireDefault(_isNil2);
var _invoke2 = require('lodash/invoke');
var _invoke3 = _interopRequireDefault(_invoke2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
var _ListContent = require('./ListContent');
var _ListContent2 = _interopRequireDefault(_ListContent);
var _ListDescription = require('./ListDescription');
var _ListDescription2 = _interopRequireDefault(_ListDescription);
var _ListHeader = require('./ListHeader');
var _ListHeader2 = _interopRequireDefault(_ListHeader);
var _ListIcon = require('./ListIcon');
var _ListIcon2 = _interopRequireDefault(_ListIcon);
var _ListItem = require('./ListItem');
var _ListItem2 = _interopRequireDefault(_ListItem);
var _ListList = require('./ListList');
var _ListList2 = _interopRequireDefault(_ListList);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* A list groups related content.
*/
var List = function (_Component) {
(0, _inherits3.default)(List, _Component);
function List() {
var _ref;
var _temp, _this, _ret;
(0, _classCallCheck3.default)(this, List);
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return _ret = (_temp = (_this = (0, _possibleConstructorReturn3.default)(this, (_ref = List.__proto__ || Object.getPrototypeOf(List)).call.apply(_ref, [this].concat(args))), _this), _this.handleItemOverrides = function (predefinedProps) {
return {
onClick: function onClick(e, itemProps) {
(0, _invoke3.default)(predefinedProps, 'onClick', e, itemProps);
(0, _invoke3.default)(_this.props, 'onItemClick', e, itemProps);
}
};
}, _temp), (0, _possibleConstructorReturn3.default)(_this, _ret);
}
(0, _createClass3.default)(List, [{
key: 'render',
value: function render() {
var _this2 = this;
var _props = this.props,
animated = _props.animated,
bulleted = _props.bulleted,
celled = _props.celled,
children = _props.children,
className = _props.className,
divided = _props.divided,
floated = _props.floated,
horizontal = _props.horizontal,
inverted = _props.inverted,
items = _props.items,
link = _props.link,
ordered = _props.ordered,
relaxed = _props.relaxed,
selection = _props.selection,
size = _props.size,
verticalAlign = _props.verticalAlign;
var classes = (0, _classnames2.default)('ui', size, (0, _lib.useKeyOnly)(animated, 'animated'), (0, _lib.useKeyOnly)(bulleted, 'bulleted'), (0, _lib.useKeyOnly)(celled, 'celled'), (0, _lib.useKeyOnly)(divided, 'divided'), (0, _lib.useKeyOnly)(horizontal, 'horizontal'), (0, _lib.useKeyOnly)(inverted, 'inverted'), (0, _lib.useKeyOnly)(link, 'link'), (0, _lib.useKeyOnly)(ordered, 'ordered'), (0, _lib.useKeyOnly)(selection, 'selection'), (0, _lib.useKeyOrValueAndKey)(relaxed, 'relaxed'), (0, _lib.useValueAndKey)(floated, 'floated'), (0, _lib.useVerticalAlignProp)(verticalAlign), 'list', className);
var rest = (0, _lib.getUnhandledProps)(List, this.props);
var ElementType = (0, _lib.getElementType)(List, this.props);
if (!(0, _isNil3.default)(children)) {
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { role: 'list', className: classes }),
children
);
}
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { role: 'list', className: classes }),
(0, _map3.default)(items, function (item) {
return _ListItem2.default.create(item, { overrideProps: _this2.handleItemOverrides });
})
);
}
}]);
return List;
}(_react.Component);
List._meta = {
name: 'List',
type: _lib.META.TYPES.ELEMENT
};
List.Content = _ListContent2.default;
List.Description = _ListDescription2.default;
List.Header = _ListHeader2.default;
List.Icon = _ListIcon2.default;
List.Item = _ListItem2.default;
List.List = _ListList2.default;
process.env.NODE_ENV !== "production" ? List.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** A list can animate to set the current item apart from the list. */
animated: _propTypes2.default.bool,
/** A list can mark items with a bullet. */
bulleted: _propTypes2.default.bool,
/** A list can divide its items into cells. */
celled: _propTypes2.default.bool,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string,
/** A list can show divisions between content. */
divided: _propTypes2.default.bool,
/** An list can be floated left or right. */
floated: _propTypes2.default.oneOf(_lib.SUI.FLOATS),
/** A list can be formatted to have items appear horizontally. */
horizontal: _propTypes2.default.bool,
/** A list can be inverted to appear on a dark background. */
inverted: _propTypes2.default.bool,
/** Shorthand array of props for ListItem. */
items: _lib.customPropTypes.collectionShorthand,
/** A list can be specially formatted for navigation links. */
link: _propTypes2.default.bool,
/**
* onClick handler for ListItem. Mutually exclusive with children.
*
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {object} data - All item props.
*/
onItemClick: _lib.customPropTypes.every([_lib.customPropTypes.disallow(['children']), _propTypes2.default.func]),
/** A list can be ordered numerically. */
ordered: _propTypes2.default.bool,
/** A list can relax its padding to provide more negative space. */
relaxed: _propTypes2.default.oneOfType([_propTypes2.default.bool, _propTypes2.default.oneOf(['very'])]),
/** A selection list formats list items as possible choices. */
selection: _propTypes2.default.bool,
/** A list can vary in size. */
size: _propTypes2.default.oneOf(_lib.SUI.SIZES),
/** An element inside a list can be vertically aligned. */
verticalAlign: _propTypes2.default.oneOf(_lib.SUI.VERTICAL_ALIGNMENTS)
} : void 0;
List.handledProps = ['animated', 'as', 'bulleted', 'celled', 'children', 'className', 'divided', 'floated', 'horizontal', 'inverted', 'items', 'link', 'onItemClick', 'ordered', 'relaxed', 'selection', 'size', 'verticalAlign'];
exports.default = List;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 7 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _isNil2 = require('lodash/isNil');
var _isNil3 = _interopRequireDefault(_isNil2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
var _ListDescription = require('./ListDescription');
var _ListDescription2 = _interopRequireDefault(_ListDescription);
var _ListHeader = require('./ListHeader');
var _ListHeader2 = _interopRequireDefault(_ListHeader);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* A list item can contain a content.
*/
function ListContent(props) {
var children = props.children,
className = props.className,
content = props.content,
description = props.description,
floated = props.floated,
header = props.header,
verticalAlign = props.verticalAlign;
var classes = (0, _classnames2.default)((0, _lib.useValueAndKey)(floated, 'floated'), (0, _lib.useVerticalAlignProp)(verticalAlign), 'content', className);
var rest = (0, _lib.getUnhandledProps)(ListContent, props);
var ElementType = (0, _lib.getElementType)(ListContent, props);
if (!(0, _isNil3.default)(children)) return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
children
);
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
_ListHeader2.default.create(header),
_ListDescription2.default.create(description),
content
);
}
ListContent.handledProps = ['as', 'children', 'className', 'content', 'description', 'floated', 'header', 'verticalAlign'];
ListContent._meta = {
name: 'ListContent',
parent: 'List',
type: _lib.META.TYPES.ELEMENT
};
process.env.NODE_ENV !== "production" ? ListContent.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string,
/** Shorthand for primary content. */
content: _lib.customPropTypes.contentShorthand,
/** Shorthand for ListDescription. */
description: _lib.customPropTypes.itemShorthand,
/** An list content can be floated left or right. */
floated: _propTypes2.default.oneOf(_lib.SUI.FLOATS),
/** Shorthand for ListHeader. */
header: _lib.customPropTypes.itemShorthand,
/** An element inside a list can be vertically aligned. */
verticalAlign: _propTypes2.default.oneOf(_lib.SUI.VERTICAL_ALIGNMENTS)
} : void 0;
ListContent.create = (0, _lib.createShorthandFactory)(ListContent, function (content) {
return { content: content };
});
exports.default = ListContent;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | 1 1 1 1 1 1 1 1 1 1 1 1 5 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _isNil2 = require('lodash/isNil');
var _isNil3 = _interopRequireDefault(_isNil2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* A list item can contain a description.
*/
function ListDescription(props) {
var children = props.children,
className = props.className,
content = props.content;
var classes = (0, _classnames2.default)(className, 'description');
var rest = (0, _lib.getUnhandledProps)(ListDescription, props);
var ElementType = (0, _lib.getElementType)(ListDescription, props);
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
(0, _isNil3.default)(children) ? content : children
);
}
ListDescription.handledProps = ['as', 'children', 'className', 'content'];
ListDescription._meta = {
name: 'ListDescription',
parent: 'List',
type: _lib.META.TYPES.ELEMENT
};
process.env.NODE_ENV !== "production" ? ListDescription.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string,
/** Shorthand for primary content. */
content: _lib.customPropTypes.contentShorthand
} : void 0;
ListDescription.create = (0, _lib.createShorthandFactory)(ListDescription, function (content) {
return { content: content };
});
exports.default = ListDescription;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | 1 1 1 1 1 1 1 1 1 1 1 1 5 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _isNil2 = require('lodash/isNil');
var _isNil3 = _interopRequireDefault(_isNil2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* A list item can contain a header.
*/
function ListHeader(props) {
var children = props.children,
className = props.className,
content = props.content;
var classes = (0, _classnames2.default)('header', className);
var rest = (0, _lib.getUnhandledProps)(ListHeader, props);
var ElementType = (0, _lib.getElementType)(ListHeader, props);
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
(0, _isNil3.default)(children) ? content : children
);
}
ListHeader.handledProps = ['as', 'children', 'className', 'content'];
ListHeader._meta = {
name: 'ListHeader',
parent: 'List',
type: _lib.META.TYPES.ELEMENT
};
process.env.NODE_ENV !== "production" ? ListHeader.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string,
/** Shorthand for primary content. */
content: _lib.customPropTypes.contentShorthand
} : void 0;
ListHeader.create = (0, _lib.createShorthandFactory)(ListHeader, function (content) {
return { content: content };
});
exports.default = ListHeader;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | 1 1 1 1 1 1 1 1 1 1 1 1 5 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
var _Icon = require('../Icon/Icon');
var _Icon2 = _interopRequireDefault(_Icon);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* A list item can contain an icon.
*/
function ListIcon(props) {
var className = props.className,
verticalAlign = props.verticalAlign;
var classes = (0, _classnames2.default)((0, _lib.useVerticalAlignProp)(verticalAlign), className);
var rest = (0, _lib.getUnhandledProps)(ListIcon, props);
return _react2.default.createElement(_Icon2.default, (0, _extends3.default)({}, rest, { className: classes }));
}
ListIcon.handledProps = ['className', 'verticalAlign'];
ListIcon._meta = {
name: 'ListIcon',
parent: 'List',
type: _lib.META.TYPES.ELEMENT
};
process.env.NODE_ENV !== "production" ? ListIcon.propTypes = {
/** Additional classes. */
className: _propTypes2.default.string,
/** An element inside a list can be vertically aligned. */
verticalAlign: _propTypes2.default.oneOf(_lib.SUI.VERTICAL_ALIGNMENTS)
} : void 0;
ListIcon.create = (0, _lib.createShorthandFactory)(ListIcon, function (name) {
return { name: name };
});
exports.default = ListIcon;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 | 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 15 1 1 1 1 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
var _createClass2 = require('babel-runtime/helpers/createClass');
var _createClass3 = _interopRequireDefault(_createClass2);
var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
var _inherits2 = require('babel-runtime/helpers/inherits');
var _inherits3 = _interopRequireDefault(_inherits2);
var _isPlainObject2 = require('lodash/isPlainObject');
var _isPlainObject3 = _interopRequireDefault(_isPlainObject2);
var _isNil2 = require('lodash/isNil');
var _isNil3 = _interopRequireDefault(_isNil2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
var _Image = require('../../elements/Image');
var _Image2 = _interopRequireDefault(_Image);
var _ListContent = require('./ListContent');
var _ListContent2 = _interopRequireDefault(_ListContent);
var _ListDescription = require('./ListDescription');
var _ListDescription2 = _interopRequireDefault(_ListDescription);
var _ListHeader = require('./ListHeader');
var _ListHeader2 = _interopRequireDefault(_ListHeader);
var _ListIcon = require('./ListIcon');
var _ListIcon2 = _interopRequireDefault(_ListIcon);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* A list item can contain a set of items.
*/
var ListItem = function (_Component) {
(0, _inherits3.default)(ListItem, _Component);
function ListItem() {
var _ref;
var _temp, _this, _ret;
(0, _classCallCheck3.default)(this, ListItem);
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return _ret = (_temp = (_this = (0, _possibleConstructorReturn3.default)(this, (_ref = ListItem.__proto__ || Object.getPrototypeOf(ListItem)).call.apply(_ref, [this].concat(args))), _this), _this.handleClick = function (e) {
var onClick = _this.props.onClick;
if (onClick) onClick(e, _this.props);
}, _temp), (0, _possibleConstructorReturn3.default)(_this, _ret);
}
(0, _createClass3.default)(ListItem, [{
key: 'render',
value: function render() {
var _props = this.props,
active = _props.active,
children = _props.children,
className = _props.className,
content = _props.content,
description = _props.description,
disabled = _props.disabled,
header = _props.header,
icon = _props.icon,
image = _props.image,
value = _props.value;
var ElementType = (0, _lib.getElementType)(ListItem, this.props);
var classes = (0, _classnames2.default)((0, _lib.useKeyOnly)(active, 'active'), (0, _lib.useKeyOnly)(disabled, 'disabled'), (0, _lib.useKeyOnly)(ElementType !== 'li', 'item'), className);
var rest = (0, _lib.getUnhandledProps)(ListItem, this.props);
var valueProp = ElementType === 'li' ? { value: value } : { 'data-value': value };
if (!(0, _isNil3.default)(children)) {
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, valueProp, { role: 'listitem', className: classes, onClick: this.handleClick }),
children
);
}
var iconElement = _ListIcon2.default.create(icon);
var imageElement = _Image2.default.create(image);
// See description of `content` prop for explanation about why this is necessary.
if (!(0, _react.isValidElement)(content) && (0, _isPlainObject3.default)(content)) {
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, valueProp, { role: 'listitem', className: classes, onClick: this.handleClick }),
iconElement || imageElement,
_ListContent2.default.create(content, { header: header, description: description })
);
}
var headerElement = _ListHeader2.default.create(header);
var descriptionElement = _ListDescription2.default.create(description);
if (iconElement || imageElement) {
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, valueProp, { role: 'listitem', className: classes, onClick: this.handleClick }),
iconElement || imageElement,
(content || headerElement || descriptionElement) && _react2.default.createElement(
_ListContent2.default,
null,
headerElement,
descriptionElement,
content
)
);
}
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, valueProp, { role: 'listitem', className: classes, onClick: this.handleClick }),
headerElement,
descriptionElement,
content
);
}
}]);
return ListItem;
}(_react.Component);
ListItem._meta = {
name: 'ListItem',
parent: 'List',
type: _lib.META.TYPES.ELEMENT
};
process.env.NODE_ENV !== "production" ? ListItem.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** A list item can active. */
active: _propTypes2.default.bool,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string,
/**
* Shorthand for primary content.
*
* Heads up!
*
* This is handled slightly differently than the typical `content` prop since
* the wrapping ListContent is not used when there's no icon or image.
*
* If you pass content as:
* - an element/literal, it's treated as the sibling node to
* header/description (whether wrapped in Item.Content or not).
* - a props object, it forces the presence of Item.Content and passes those
* props to it. If you pass a content prop within that props object, it
* will be treated as the sibling node to header/description.
*/
content: _lib.customPropTypes.itemShorthand,
/** Shorthand for ListDescription. */
description: _lib.customPropTypes.itemShorthand,
/** A list item can disabled. */
disabled: _propTypes2.default.bool,
/** Shorthand for ListHeader. */
header: _lib.customPropTypes.itemShorthand,
/** Shorthand for ListIcon. */
icon: _lib.customPropTypes.every([_lib.customPropTypes.disallow(['image']), _lib.customPropTypes.itemShorthand]),
/** Shorthand for Image. */
image: _lib.customPropTypes.every([_lib.customPropTypes.disallow(['icon']), _lib.customPropTypes.itemShorthand]),
/** A ListItem can be clicked */
onClick: _propTypes2.default.func,
/** A value for an ordered list. */
value: _propTypes2.default.string
} : void 0;
ListItem.handledProps = ['active', 'as', 'children', 'className', 'content', 'description', 'disabled', 'header', 'icon', 'image', 'onClick', 'value'];
ListItem.create = (0, _lib.createShorthandFactory)(ListItem, function (content) {
return { content: content };
});
exports.default = ListItem;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | 1 1 1 1 1 1 1 1 1 1 4 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* A list can contain a sub list.
*/
function ListList(props) {
var children = props.children,
className = props.className;
var rest = (0, _lib.getUnhandledProps)(ListList, props);
var ElementType = (0, _lib.getElementType)(ListList, props);
var classes = (0, _classnames2.default)((0, _lib.useKeyOnly)(ElementType !== 'ul' && ElementType !== 'ol', 'list'), className);
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
children
);
}
ListList.handledProps = ['as', 'children', 'className'];
ListList._meta = {
name: 'ListList',
parent: 'List',
type: _lib.META.TYPES.ELEMENT
};
process.env.NODE_ENV !== "production" ? ListList.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string
} : void 0;
exports.default = ListList;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = undefined;
var _List = require('./List');
var _List2 = _interopRequireDefault(_List);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = _List2.default;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | 1 1 1 1 1 1 1 1 1 1 1 1 5 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _isNil2 = require('lodash/isNil');
var _isNil3 = _interopRequireDefault(_isNil2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* A loader alerts a user to wait for an activity to complete.
* @see Dimmer
*/
function Loader(props) {
var active = props.active,
children = props.children,
className = props.className,
content = props.content,
disabled = props.disabled,
indeterminate = props.indeterminate,
inline = props.inline,
inverted = props.inverted,
size = props.size;
var classes = (0, _classnames2.default)('ui', size, (0, _lib.useKeyOnly)(active, 'active'), (0, _lib.useKeyOnly)(disabled, 'disabled'), (0, _lib.useKeyOnly)(indeterminate, 'indeterminate'), (0, _lib.useKeyOnly)(inverted, 'inverted'), (0, _lib.useKeyOnly)(children || content, 'text'), (0, _lib.useKeyOrValueAndKey)(inline, 'inline'), 'loader', className);
var rest = (0, _lib.getUnhandledProps)(Loader, props);
var ElementType = (0, _lib.getElementType)(Loader, props);
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
(0, _isNil3.default)(children) ? content : children
);
}
Loader.handledProps = ['active', 'as', 'children', 'className', 'content', 'disabled', 'indeterminate', 'inline', 'inverted', 'size'];
Loader._meta = {
name: 'Loader',
type: _lib.META.TYPES.ELEMENT
};
process.env.NODE_ENV !== "production" ? Loader.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** A loader can be active or visible. */
active: _propTypes2.default.bool,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string,
/** Shorthand for primary content. */
content: _lib.customPropTypes.contentShorthand,
/** A loader can be disabled or hidden. */
disabled: _propTypes2.default.bool,
/** A loader can show it's unsure of how long a task will take. */
indeterminate: _propTypes2.default.bool,
/** Loaders can appear inline with content. */
inline: _propTypes2.default.oneOfType([_propTypes2.default.bool, _propTypes2.default.oneOf(['centered'])]),
/** Loaders can have their colors inverted. */
inverted: _propTypes2.default.bool,
/** Loaders can have different sizes. */
size: _propTypes2.default.oneOf(_lib.SUI.SIZES)
} : void 0;
exports.default = Loader;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = undefined;
var _Loader = require('./Loader');
var _Loader2 = _interopRequireDefault(_Loader);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = _Loader2.default;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | 1 1 1 1 1 1 1 1 1 1 1 1 5 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _without2 = require('lodash/without');
var _without3 = _interopRequireDefault(_without2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* A rail is used to show accompanying content outside the boundaries of the main view of a site.
*/
function Rail(props) {
var attached = props.attached,
children = props.children,
className = props.className,
close = props.close,
dividing = props.dividing,
internal = props.internal,
position = props.position,
size = props.size;
var classes = (0, _classnames2.default)('ui', position, size, (0, _lib.useKeyOnly)(attached, 'attached'), (0, _lib.useKeyOnly)(dividing, 'dividing'), (0, _lib.useKeyOnly)(internal, 'internal'), (0, _lib.useKeyOrValueAndKey)(close, 'close'), 'rail', className);
var rest = (0, _lib.getUnhandledProps)(Rail, props);
var ElementType = (0, _lib.getElementType)(Rail, props);
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
children
);
}
Rail.handledProps = ['as', 'attached', 'children', 'className', 'close', 'dividing', 'internal', 'position', 'size'];
Rail._meta = {
name: 'Rail',
type: _lib.META.TYPES.ELEMENT
};
process.env.NODE_ENV !== "production" ? Rail.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** A rail can appear attached to the main viewport. */
attached: _propTypes2.default.bool,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string,
/** A rail can appear closer to the main viewport. */
close: _propTypes2.default.oneOfType([_propTypes2.default.bool, _propTypes2.default.oneOf(['very'])]),
/** A rail can create a division between itself and a container. */
dividing: _propTypes2.default.bool,
/** A rail can attach itself to the inside of a container. */
internal: _propTypes2.default.bool,
/** A rail can be presented on the left or right side of a container. */
position: _propTypes2.default.oneOf(_lib.SUI.FLOATS).isRequired,
/** A rail can have different sizes. */
size: _propTypes2.default.oneOf((0, _without3.default)(_lib.SUI.SIZES, 'medium'))
} : void 0;
exports.default = Rail;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = undefined;
var _Rail = require('./Rail');
var _Rail2 = _interopRequireDefault(_Rail);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = _Rail2.default;
|
| File | Statements | Branches | Functions | Lines | |||||
|---|---|---|---|---|---|---|---|---|---|
| Reveal.js | 80% | (20 / 25) | 83.33% | (5 / 6) | 50% | (1 / 2) | 79.17% | (19 / 24) | |
| RevealContent.js | 77.27% | (17 / 22) | 83.33% | (5 / 6) | 50% | (1 / 2) | 76.19% | (16 / 21) | |
| index.js | 100% | (7 / 7) | 75% | (3 / 4) | 100% | (1 / 1) | 100% | (6 / 6) |
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 | 1 1 1 1 1 1 1 1 1 1 1 1 5 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
var _RevealContent = require('./RevealContent');
var _RevealContent2 = _interopRequireDefault(_RevealContent);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* A reveal displays additional content in place of previous content when activated.
*/
function Reveal(props) {
var active = props.active,
animated = props.animated,
children = props.children,
className = props.className,
disabled = props.disabled,
instant = props.instant;
var classes = (0, _classnames2.default)('ui', animated, (0, _lib.useKeyOnly)(active, 'active'), (0, _lib.useKeyOnly)(disabled, 'disabled'), (0, _lib.useKeyOnly)(instant, 'instant'), 'reveal', className);
var rest = (0, _lib.getUnhandledProps)(Reveal, props);
var ElementType = (0, _lib.getElementType)(Reveal, props);
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
children
);
}
Reveal.handledProps = ['active', 'animated', 'as', 'children', 'className', 'disabled', 'instant'];
Reveal._meta = {
name: 'Reveal',
type: _lib.META.TYPES.ELEMENT
};
process.env.NODE_ENV !== "production" ? Reveal.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** An active reveal displays its hidden content. */
active: _propTypes2.default.bool,
/** An animation name that will be applied to Reveal. */
animated: _propTypes2.default.oneOf(['fade', 'small fade', 'move', 'move right', 'move up', 'move down', 'rotate', 'rotate left']),
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string,
/** A disabled reveal will not animate when hovered. */
disabled: _propTypes2.default.bool,
/** An element can show its content without delay. */
instant: _propTypes2.default.bool
} : void 0;
Reveal.Content = _RevealContent2.default;
exports.default = Reveal;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | 1 1 1 1 1 1 1 1 1 1 4 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* A content sub-component for the Reveal.
*/
function RevealContent(props) {
var children = props.children,
className = props.className,
hidden = props.hidden,
visible = props.visible;
var classes = (0, _classnames2.default)('ui', (0, _lib.useKeyOnly)(hidden, 'hidden'), (0, _lib.useKeyOnly)(visible, 'visible'), 'content', className);
var rest = (0, _lib.getUnhandledProps)(RevealContent, props);
var ElementType = (0, _lib.getElementType)(RevealContent, props);
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
children
);
}
RevealContent.handledProps = ['as', 'children', 'className', 'hidden', 'visible'];
RevealContent._meta = {
name: 'RevealContent',
parent: 'Reveal',
type: _lib.META.TYPES.ELEMENT
};
process.env.NODE_ENV !== "production" ? RevealContent.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string,
/** A reveal may contain content that is visible before interaction. */
hidden: _propTypes2.default.bool,
/** A reveal may contain content that is hidden before user interaction. */
visible: _propTypes2.default.bool
} : void 0;
exports.default = RevealContent;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = undefined;
var _Reveal = require('./Reveal');
var _Reveal2 = _interopRequireDefault(_Reveal);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = _Reveal2.default;
|
| File | Statements | Branches | Functions | Lines | |||||
|---|---|---|---|---|---|---|---|---|---|
| Segment.js | 81.48% | (22 / 27) | 83.33% | (5 / 6) | 50% | (1 / 2) | 80.77% | (21 / 26) | |
| SegmentGroup.js | 79.17% | (19 / 24) | 83.33% | (5 / 6) | 50% | (1 / 2) | 78.26% | (18 / 23) | |
| index.js | 100% | (7 / 7) | 75% | (3 / 4) | 100% | (1 / 1) | 100% | (6 / 6) |
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 | 1 1 1 1 1 1 1 1 1 1 1 1 1 1 6 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _without2 = require('lodash/without');
var _without3 = _interopRequireDefault(_without2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
var _SegmentGroup = require('./SegmentGroup');
var _SegmentGroup2 = _interopRequireDefault(_SegmentGroup);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* A segment is used to create a grouping of related content.
*/
function Segment(props) {
var attached = props.attached,
basic = props.basic,
children = props.children,
circular = props.circular,
className = props.className,
clearing = props.clearing,
color = props.color,
compact = props.compact,
disabled = props.disabled,
floated = props.floated,
inverted = props.inverted,
loading = props.loading,
padded = props.padded,
piled = props.piled,
raised = props.raised,
secondary = props.secondary,
size = props.size,
stacked = props.stacked,
tertiary = props.tertiary,
textAlign = props.textAlign,
vertical = props.vertical;
var classes = (0, _classnames2.default)('ui', color, size, (0, _lib.useKeyOnly)(basic, 'basic'), (0, _lib.useKeyOnly)(circular, 'circular'), (0, _lib.useKeyOnly)(clearing, 'clearing'), (0, _lib.useKeyOnly)(compact, 'compact'), (0, _lib.useKeyOnly)(disabled, 'disabled'), (0, _lib.useKeyOnly)(inverted, 'inverted'), (0, _lib.useKeyOnly)(loading, 'loading'), (0, _lib.useKeyOnly)(piled, 'piled'), (0, _lib.useKeyOnly)(raised, 'raised'), (0, _lib.useKeyOnly)(secondary, 'secondary'), (0, _lib.useKeyOnly)(stacked, 'stacked'), (0, _lib.useKeyOnly)(tertiary, 'tertiary'), (0, _lib.useKeyOnly)(vertical, 'vertical'), (0, _lib.useKeyOrValueAndKey)(attached, 'attached'), (0, _lib.useKeyOrValueAndKey)(padded, 'padded'), (0, _lib.useTextAlignProp)(textAlign), (0, _lib.useValueAndKey)(floated, 'floated'), 'segment', className);
var rest = (0, _lib.getUnhandledProps)(Segment, props);
var ElementType = (0, _lib.getElementType)(Segment, props);
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
children
);
}
Segment.handledProps = ['as', 'attached', 'basic', 'children', 'circular', 'className', 'clearing', 'color', 'compact', 'disabled', 'floated', 'inverted', 'loading', 'padded', 'piled', 'raised', 'secondary', 'size', 'stacked', 'tertiary', 'textAlign', 'vertical'];
Segment.Group = _SegmentGroup2.default;
Segment._meta = {
name: 'Segment',
type: _lib.META.TYPES.ELEMENT
};
process.env.NODE_ENV !== "production" ? Segment.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Attach segment to other content, like a header. */
attached: _propTypes2.default.oneOfType([_propTypes2.default.bool, _propTypes2.default.oneOf(['top', 'bottom'])]),
/** A basic segment has no special formatting. */
basic: _propTypes2.default.bool,
/** Primary content. */
children: _propTypes2.default.node,
/** A segment can be circular. */
circular: _propTypes2.default.bool,
/** Additional classes. */
className: _propTypes2.default.string,
/** A segment can clear floated content. */
clearing: _propTypes2.default.bool,
/** Segment can be colored. */
color: _propTypes2.default.oneOf(_lib.SUI.COLORS),
/** A segment may take up only as much space as is necessary. */
compact: _propTypes2.default.bool,
/** A segment may show its content is disabled. */
disabled: _propTypes2.default.bool,
/** Segment content can be floated to the left or right. */
floated: _propTypes2.default.oneOf(_lib.SUI.FLOATS),
/** A segment can have its colors inverted for contrast. */
inverted: _propTypes2.default.bool,
/** A segment may show its content is being loaded. */
loading: _propTypes2.default.bool,
/** A segment can increase its padding. */
padded: _propTypes2.default.oneOfType([_propTypes2.default.bool, _propTypes2.default.oneOf(['very'])]),
/** Formatted to look like a pile of pages. */
piled: _propTypes2.default.bool,
/** A segment may be formatted to raise above the page. */
raised: _propTypes2.default.bool,
/** A segment can be formatted to appear less noticeable. */
secondary: _propTypes2.default.bool,
/** A segment can have different sizes. */
size: _propTypes2.default.oneOf((0, _without3.default)(_lib.SUI.SIZES, 'medium')),
/** Formatted to show it contains multiple pages. */
stacked: _propTypes2.default.bool,
/** A segment can be formatted to appear even less noticeable. */
tertiary: _propTypes2.default.bool,
/** Formats content to be aligned as part of a vertical group. */
textAlign: _propTypes2.default.oneOf((0, _without3.default)(_lib.SUI.TEXT_ALIGNMENTS, 'justified')),
/** Formats content to be aligned vertically. */
vertical: _propTypes2.default.bool
} : void 0;
exports.default = Segment;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 | 1 1 1 1 1 1 1 1 1 1 1 1 5 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _without2 = require('lodash/without');
var _without3 = _interopRequireDefault(_without2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* A group of segments can be formatted to appear together.
*/
function SegmentGroup(props) {
var children = props.children,
className = props.className,
compact = props.compact,
horizontal = props.horizontal,
piled = props.piled,
raised = props.raised,
size = props.size,
stacked = props.stacked;
var classes = (0, _classnames2.default)('ui', size, (0, _lib.useKeyOnly)(compact, 'compact'), (0, _lib.useKeyOnly)(horizontal, 'horizontal'), (0, _lib.useKeyOnly)(piled, 'piled'), (0, _lib.useKeyOnly)(raised, 'raised'), (0, _lib.useKeyOnly)(stacked, 'stacked'), 'segments', className);
var rest = (0, _lib.getUnhandledProps)(SegmentGroup, props);
var ElementType = (0, _lib.getElementType)(SegmentGroup, props);
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
children
);
}
SegmentGroup.handledProps = ['as', 'children', 'className', 'compact', 'horizontal', 'piled', 'raised', 'size', 'stacked'];
SegmentGroup._meta = {
name: 'SegmentGroup',
parent: 'Segment',
type: _lib.META.TYPES.ELEMENT
};
process.env.NODE_ENV !== "production" ? SegmentGroup.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string,
/** A segment may take up only as much space as is necessary. */
compact: _propTypes2.default.bool,
/** Formats content to be aligned horizontally. */
horizontal: _propTypes2.default.bool,
/** Formatted to look like a pile of pages. */
piled: _propTypes2.default.bool,
/** A segment group may be formatted to raise above the page. */
raised: _propTypes2.default.bool,
/** A segment group can have different sizes. */
size: _propTypes2.default.oneOf((0, _without3.default)(_lib.SUI.SIZES, 'medium')),
/** Formatted to show it contains multiple pages. */
stacked: _propTypes2.default.bool
} : void 0;
exports.default = SegmentGroup;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = undefined;
var _Segment = require('./Segment');
var _Segment2 = _interopRequireDefault(_Segment);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = _Segment2.default;
|
| File | Statements | Branches | Functions | Lines | |||||
|---|---|---|---|---|---|---|---|---|---|
| Step.js | 71.43% | (45 / 63) | 35.71% | (5 / 14) | 33.33% | (2 / 6) | 73.33% | (44 / 60) | |
| StepContent.js | 71.88% | (23 / 32) | 62.5% | (5 / 8) | 25% | (1 / 4) | 70.97% | (22 / 31) | |
| StepDescription.js | 79.17% | (19 / 24) | 62.5% | (5 / 8) | 50% | (1 / 2) | 78.26% | (18 / 23) | |
| StepGroup.js | 71.43% | (25 / 35) | 50% | (5 / 10) | 33.33% | (1 / 3) | 70.59% | (24 / 34) | |
| StepTitle.js | 79.17% | (19 / 24) | 62.5% | (5 / 8) | 50% | (1 / 2) | 78.26% | (18 / 23) | |
| index.js | 100% | (7 / 7) | 75% | (3 / 4) | 100% | (1 / 1) | 100% | (6 / 6) |
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 | 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 14 1 1 1 1 1 1 1 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
var _createClass2 = require('babel-runtime/helpers/createClass');
var _createClass3 = _interopRequireDefault(_createClass2);
var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
var _inherits2 = require('babel-runtime/helpers/inherits');
var _inherits3 = _interopRequireDefault(_inherits2);
var _isNil2 = require('lodash/isNil');
var _isNil3 = _interopRequireDefault(_isNil2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
var _Icon = require('../../elements/Icon');
var _Icon2 = _interopRequireDefault(_Icon);
var _StepContent = require('./StepContent');
var _StepContent2 = _interopRequireDefault(_StepContent);
var _StepDescription = require('./StepDescription');
var _StepDescription2 = _interopRequireDefault(_StepDescription);
var _StepGroup = require('./StepGroup');
var _StepGroup2 = _interopRequireDefault(_StepGroup);
var _StepTitle = require('./StepTitle');
var _StepTitle2 = _interopRequireDefault(_StepTitle);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* A step shows the completion status of an activity in a series of activities.
*/
var Step = function (_Component) {
(0, _inherits3.default)(Step, _Component);
function Step() {
var _ref;
var _temp, _this, _ret;
(0, _classCallCheck3.default)(this, Step);
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return _ret = (_temp = (_this = (0, _possibleConstructorReturn3.default)(this, (_ref = Step.__proto__ || Object.getPrototypeOf(Step)).call.apply(_ref, [this].concat(args))), _this), _this.handleClick = function (e) {
var onClick = _this.props.onClick;
if (onClick) onClick(e, _this.props);
}, _temp), (0, _possibleConstructorReturn3.default)(_this, _ret);
}
(0, _createClass3.default)(Step, [{
key: 'render',
value: function render() {
var _props = this.props,
active = _props.active,
children = _props.children,
className = _props.className,
completed = _props.completed,
description = _props.description,
disabled = _props.disabled,
href = _props.href,
icon = _props.icon,
link = _props.link,
onClick = _props.onClick,
title = _props.title;
var classes = (0, _classnames2.default)((0, _lib.useKeyOnly)(active, 'active'), (0, _lib.useKeyOnly)(completed, 'completed'), (0, _lib.useKeyOnly)(disabled, 'disabled'), (0, _lib.useKeyOnly)(link, 'link'), 'step', className);
var rest = (0, _lib.getUnhandledProps)(Step, this.props);
var ElementType = (0, _lib.getElementType)(Step, this.props, function () {
if (onClick) return 'a';
});
if (!(0, _isNil3.default)(children)) {
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes, href: href, onClick: this.handleClick }),
children
);
}
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes, href: href, onClick: this.handleClick }),
_Icon2.default.create(icon),
_react2.default.createElement(_StepContent2.default, { description: description, title: title })
);
}
}]);
return Step;
}(_react.Component);
Step._meta = {
name: 'Step',
type: _lib.META.TYPES.ELEMENT
};
Step.Content = _StepContent2.default;
Step.Description = _StepDescription2.default;
Step.Group = _StepGroup2.default;
Step.Title = _StepTitle2.default;
exports.default = Step;
process.env.NODE_ENV !== "production" ? Step.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** A step can be highlighted as active. */
active: _propTypes2.default.bool,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string,
/** A step can show that a user has completed it. */
completed: _propTypes2.default.bool,
/** Shorthand for StepDescription. */
description: _lib.customPropTypes.itemShorthand,
/** Show that the Loader is inactive. */
disabled: _propTypes2.default.bool,
/** Render as an `a` tag instead of a `div` and adds the href attribute. */
href: _propTypes2.default.string,
/** Shorthand for Icon. */
icon: _lib.customPropTypes.itemShorthand,
/** A step can be link. */
link: _propTypes2.default.bool,
/**
* Called on click. When passed, the component will render as an `a`
* tag by default instead of a `div`.
*
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {object} data - All props.
*/
onClick: _propTypes2.default.func,
/** A step can show a ordered sequence of steps. Passed from StepGroup. */
ordered: _propTypes2.default.bool,
/** Shorthand for StepTitle. */
title: _lib.customPropTypes.itemShorthand
} : void 0;
Step.handledProps = ['active', 'as', 'children', 'className', 'completed', 'description', 'disabled', 'href', 'icon', 'link', 'onClick', 'ordered', 'title'];
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 | 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 7 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _isNil2 = require('lodash/isNil');
var _isNil3 = _interopRequireDefault(_isNil2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
var _StepDescription = require('./StepDescription');
var _StepDescription2 = _interopRequireDefault(_StepDescription);
var _StepTitle = require('./StepTitle');
var _StepTitle2 = _interopRequireDefault(_StepTitle);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* A step can contain a content.
*/
function StepContent(props) {
var children = props.children,
className = props.className,
description = props.description,
title = props.title;
var classes = (0, _classnames2.default)('content', className);
var rest = (0, _lib.getUnhandledProps)(StepContent, props);
var ElementType = (0, _lib.getElementType)(StepContent, props);
if (!(0, _isNil3.default)(children)) {
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
children
);
}
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
(0, _lib.createShorthand)(_StepTitle2.default, function (val) {
return { title: val };
}, title),
(0, _lib.createShorthand)(_StepDescription2.default, function (val) {
return { description: val };
}, description)
);
}
StepContent.handledProps = ['as', 'children', 'className', 'description', 'title'];
StepContent._meta = {
name: 'StepContent',
parent: 'Step',
type: _lib.META.TYPES.ELEMENT
};
process.env.NODE_ENV !== "production" ? StepContent.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Additional classes. */
className: _propTypes2.default.string,
/** Primary content. */
children: _propTypes2.default.node,
/** Shorthand for StepDescription. */
description: _lib.customPropTypes.itemShorthand,
/** Shorthand for StepTitle. */
title: _lib.customPropTypes.itemShorthand
} : void 0;
exports.default = StepContent;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | 1 1 1 1 1 1 1 1 1 1 1 1 5 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _isNil2 = require('lodash/isNil');
var _isNil3 = _interopRequireDefault(_isNil2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function StepDescription(props) {
var children = props.children,
className = props.className,
description = props.description;
var classes = (0, _classnames2.default)('description', className);
var rest = (0, _lib.getUnhandledProps)(StepDescription, props);
var ElementType = (0, _lib.getElementType)(StepDescription, props);
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
(0, _isNil3.default)(children) ? description : children
);
}
StepDescription.handledProps = ['as', 'children', 'className', 'description'];
StepDescription._meta = {
name: 'StepDescription',
parent: 'Step',
type: _lib.META.TYPES.ELEMENT
};
process.env.NODE_ENV !== "production" ? StepDescription.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Additional classes. */
className: _propTypes2.default.string,
/** Primary content. */
children: _propTypes2.default.node,
/** Shorthand for primary content. */
description: _lib.customPropTypes.contentShorthand
} : void 0;
exports.default = StepDescription;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 | 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 8 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _without2 = require('lodash/without');
var _without3 = _interopRequireDefault(_without2);
var _map2 = require('lodash/map');
var _map3 = _interopRequireDefault(_map2);
var _isNil2 = require('lodash/isNil');
var _isNil3 = _interopRequireDefault(_isNil2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
var _Step = require('./Step');
var _Step2 = _interopRequireDefault(_Step);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* A set of steps.
*/
function StepGroup(props) {
var children = props.children,
className = props.className,
fluid = props.fluid,
items = props.items,
ordered = props.ordered,
size = props.size,
stackable = props.stackable,
vertical = props.vertical;
var classes = (0, _classnames2.default)('ui', size, (0, _lib.useKeyOnly)(fluid, 'fluid'), (0, _lib.useKeyOnly)(ordered, 'ordered'), (0, _lib.useKeyOnly)(vertical, 'vertical'), (0, _lib.useValueAndKey)(stackable, 'stackable'), 'steps', className);
var rest = (0, _lib.getUnhandledProps)(StepGroup, props);
var ElementType = (0, _lib.getElementType)(StepGroup, props);
if (!(0, _isNil3.default)(children)) {
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
children
);
}
var content = (0, _map3.default)(items, function (item) {
var key = item.key || [item.title, item.description].join('-');
return _react2.default.createElement(_Step2.default, (0, _extends3.default)({ key: key }, item));
});
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
content
);
}
StepGroup.handledProps = ['as', 'children', 'className', 'fluid', 'items', 'ordered', 'size', 'stackable', 'vertical'];
StepGroup._meta = {
name: 'StepGroup',
parent: 'Step',
type: _lib.META.TYPES.ELEMENT
};
process.env.NODE_ENV !== "production" ? StepGroup.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string,
/** A fluid step takes up the width of its container. */
fluid: _propTypes2.default.bool,
/** Shorthand array of props for Step. */
items: _lib.customPropTypes.collectionShorthand,
/** A step can show a ordered sequence of steps. */
ordered: _propTypes2.default.bool,
/** Steps can have different sizes. */
size: _propTypes2.default.oneOf((0, _without3.default)(_lib.SUI.SIZES, 'medium')),
/** A step can stack vertically only on smaller screens. */
stackable: _propTypes2.default.oneOf(['tablet']),
/** A step can be displayed stacked vertically. */
vertical: _propTypes2.default.bool
} : void 0;
exports.default = StepGroup;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | 1 1 1 1 1 1 1 1 1 1 1 1 5 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _isNil2 = require('lodash/isNil');
var _isNil3 = _interopRequireDefault(_isNil2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* A step can contain a title.
*/
function StepTitle(props) {
var children = props.children,
className = props.className,
title = props.title;
var classes = (0, _classnames2.default)('title', className);
var rest = (0, _lib.getUnhandledProps)(StepTitle, props);
var ElementType = (0, _lib.getElementType)(StepTitle, props);
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
(0, _isNil3.default)(children) ? title : children
);
}
StepTitle.handledProps = ['as', 'children', 'className', 'title'];
StepTitle._meta = {
name: 'StepTitle',
parent: 'Step',
type: _lib.META.TYPES.ELEMENT
};
process.env.NODE_ENV !== "production" ? StepTitle.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Additional classes. */
className: _propTypes2.default.string,
/** Primary content. */
children: _propTypes2.default.node,
/** Shorthand for primary content. */
title: _lib.customPropTypes.contentShorthand
} : void 0;
exports.default = StepTitle;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = undefined;
var _Step = require('./Step');
var _Step2 = _interopRequireDefault(_Step);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = _Step2.default;
|
| File | Statements | Branches | Functions | Lines | |||||
|---|---|---|---|---|---|---|---|---|---|
| AutoControlledComponent.js | 33.88% | (41 / 121) | 6.25% | (4 / 64) | 15.38% | (2 / 13) | 37.04% | (40 / 108) | |
| META.js | 80.95% | (34 / 42) | 30% | (3 / 10) | 25% | (1 / 4) | 86.84% | (33 / 38) | |
| SUI.js | 100% | (47 / 47) | 100% | (4 / 4) | 100% | (1 / 1) | 100% | (46 / 46) | |
| childrenUtils.js | 84.62% | (11 / 13) | 75% | (3 / 4) | 33.33% | (1 / 3) | 83.33% | (10 / 12) | |
| classNameBuilders.js | 45.16% | (14 / 31) | 7.89% | (3 / 38) | 11.11% | (1 / 9) | 44.83% | (13 / 29) | |
| customPropTypes.js | 34.44% | (62 / 180) | 5.19% | (4 / 77) | 21.62% | (8 / 37) | 36.53% | (61 / 167) | |
| debug.js | 63.64% | (14 / 22) | 55.56% | (5 / 9) | 75% | (3 / 4) | 61.9% | (13 / 21) | |
| factories.js | 48.78% | (40 / 82) | 10% | (7 / 70) | 22.22% | (2 / 9) | 50% | (39 / 78) | |
| getElementType.js | 23.08% | (3 / 13) | 0% | (0 / 14) | 0% | (0 / 1) | 30% | (3 / 10) | |
| getUnhandledProps.js | 30% | (3 / 10) | 0% | (0 / 6) | 0% | (0 / 2) | 37.5% | (3 / 8) | |
| htmlInputPropsUtils.js | 66.67% | (12 / 18) | 30% | (3 / 10) | 33.33% | (1 / 3) | 64.71% | (11 / 17) | |
| index.js | 67.82% | (59 / 87) | 56.25% | (9 / 16) | 23.08% | (6 / 26) | 73.68% | (56 / 76) | |
| isBrowser.js | 100% | (8 / 8) | 53.33% | (8 / 15) | 100% | (1 / 1) | 100% | (7 / 7) | |
| keyboardKey.js | 84.85% | (56 / 66) | 15.79% | (3 / 19) | 60% | (3 / 5) | 84.62% | (55 / 65) | |
| leven.js | 20.59% | (7 / 34) | 6.25% | (1 / 16) | 0% | (0 / 2) | 22.58% | (7 / 31) | |
| numberToWord.js | 69.23% | (9 / 13) | 25% | (3 / 12) | 50% | (1 / 2) | 66.67% | (8 / 12) | |
| objectDiff.js | 68.75% | (11 / 16) | 37.5% | (3 / 8) | 33.33% | (1 / 3) | 76.92% | (10 / 13) |
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 | 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 14 1 1 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.getAutoControlledStateValue = undefined;
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
var _createClass2 = require('babel-runtime/helpers/createClass');
var _createClass3 = _interopRequireDefault(_createClass2);
var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
var _inherits2 = require('babel-runtime/helpers/inherits');
var _inherits3 = _interopRequireDefault(_inherits2);
var _difference2 = require('lodash/difference');
var _difference3 = _interopRequireDefault(_difference2);
var _isUndefined2 = require('lodash/isUndefined');
var _isUndefined3 = _interopRequireDefault(_isUndefined2);
var _startsWith2 = require('lodash/startsWith');
var _startsWith3 = _interopRequireDefault(_startsWith2);
var _filter2 = require('lodash/filter');
var _filter3 = _interopRequireDefault(_filter2);
var _isEmpty2 = require('lodash/isEmpty');
var _isEmpty3 = _interopRequireDefault(_isEmpty2);
var _keys2 = require('lodash/keys');
var _keys3 = _interopRequireDefault(_keys2);
var _intersection2 = require('lodash/intersection');
var _intersection3 = _interopRequireDefault(_intersection2);
var _has2 = require('lodash/has');
var _has3 = _interopRequireDefault(_has2);
var _each2 = require('lodash/each');
var _each3 = _interopRequireDefault(_each2);
var _react = require('react');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var getDefaultPropName = function getDefaultPropName(prop) {
return 'default' + (prop[0].toUpperCase() + prop.slice(1));
};
/**
* Return the auto controlled state value for a give prop. The initial value is chosen in this order:
* - regular props
* - then, default props
* - then, initial state
* - then, `checked` defaults to false
* - then, `value` defaults to '' or [] if props.multiple
* - else, undefined
*
* @param {string} propName A prop name
* @param {object} [props] A props object
* @param {object} [state] A state object
* @param {boolean} [includeDefaults=false] Whether or not to heed the default props or initial state
*/
/* eslint-disable no-console */
/**
* Why choose inheritance over a HOC? Multiple advantages for this particular use case.
* In short, we need identical functionality to setState(), unless there is a prop defined
* for the state key. Also:
*
* 1. Single Renders
* Calling trySetState() in constructor(), componentWillMount(), or componentWillReceiveProps()
* does not cause two renders. Consumers and tests do not have to wait two renders to get state.
* See www.react.run/4kJFdKoxb/27 for an example of this issue.
*
* 2. Simple Testing
* Using a HOC means you must either test the undecorated component or test through the decorator.
* Testing the undecorated component means you must mock the decorator functionality.
* Testing through the HOC means you can not simply shallow render your component.
*
* 3. Statics
* HOC wrap instances, so statics are no longer accessible. They can be hoisted, but this is more
* looping over properties and storing references. We rely heavily on statics for testing and sub
* components.
*
* 4. Instance Methods
* Some instance methods may be exposed to users via refs. Again, these are lost with HOC unless
* hoisted and exposed by the HOC.
*/
var getAutoControlledStateValue = exports.getAutoControlledStateValue = function getAutoControlledStateValue(propName, props, state) {
var includeDefaults = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false;
// regular props
var propValue = props[propName];
if (propValue !== undefined) return propValue;
if (includeDefaults) {
// defaultProps
var defaultProp = props[getDefaultPropName(propName)];
if (defaultProp !== undefined) return defaultProp;
// initial state - state may be null or undefined
if (state) {
var initialState = state[propName];
if (initialState !== undefined) return initialState;
}
}
// React doesn't allow changing from uncontrolled to controlled components,
// default checked/value if they were not present.
if (propName === 'checked') return false;
if (propName === 'value') return props.multiple ? [] : '';
// otherwise, undefined
};
var AutoControlledComponent = function (_Component) {
(0, _inherits3.default)(AutoControlledComponent, _Component);
function AutoControlledComponent() {
var _ref;
var _temp, _this, _ret;
(0, _classCallCheck3.default)(this, AutoControlledComponent);
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return _ret = (_temp = (_this = (0, _possibleConstructorReturn3.default)(this, (_ref = AutoControlledComponent.__proto__ || Object.getPrototypeOf(AutoControlledComponent)).call.apply(_ref, [this].concat(args))), _this), _this.trySetState = function (maybeState, state) {
var autoControlledProps = _this.constructor.autoControlledProps;
if (process.env.NODE_ENV !== 'production') {
var name = _this.constructor.name;
// warn about failed attempts to setState for keys not listed in autoControlledProps
var illegalKeys = (0, _difference3.default)((0, _keys3.default)(maybeState), autoControlledProps);
if (!(0, _isEmpty3.default)(illegalKeys)) {
console.error([name + ' called trySetState() with controlled props: "' + illegalKeys + '".', 'State will not be set.', 'Only props in static autoControlledProps will be set on state.'].join(' '));
}
}
var newState = Object.keys(maybeState).reduce(function (acc, prop) {
// ignore props defined by the parent
if (_this.props[prop] !== undefined) return acc;
// ignore props not listed in auto controlled props
if (autoControlledProps.indexOf(prop) === -1) return acc;
acc[prop] = maybeState[prop];
return acc;
}, {});
if (state) newState = (0, _extends3.default)({}, newState, state);
if (Object.keys(newState).length > 0) _this.setState(newState);
}, _temp), (0, _possibleConstructorReturn3.default)(_this, _ret);
}
(0, _createClass3.default)(AutoControlledComponent, [{
key: 'componentWillMount',
value: function componentWillMount() {
var _this2 = this;
var autoControlledProps = this.constructor.autoControlledProps;
if (process.env.NODE_ENV !== 'production') {
var _constructor = this.constructor,
defaultProps = _constructor.defaultProps,
name = _constructor.name,
propTypes = _constructor.propTypes;
// require static autoControlledProps
if (!autoControlledProps) {
console.error('Auto controlled ' + name + ' must specify a static autoControlledProps array.');
}
// require propTypes
(0, _each3.default)(autoControlledProps, function (prop) {
var defaultProp = getDefaultPropName(prop);
// regular prop
if (!(0, _has3.default)(propTypes, defaultProp)) {
console.error(name + ' is missing "' + defaultProp + '" propTypes validation for auto controlled prop "' + prop + '".');
}
// its default prop
if (!(0, _has3.default)(propTypes, prop)) {
console.error(name + ' is missing propTypes validation for auto controlled prop "' + prop + '".');
}
});
// prevent autoControlledProps in defaultProps
//
// When setting state, auto controlled props values always win (so the parent can manage them).
// It is not reasonable to decipher the difference between props from the parent and defaultProps.
// Allowing defaultProps results in trySetState always deferring to the defaultProp value.
// Auto controlled props also listed in defaultProps can never be updated.
//
// To set defaults for an AutoControlled prop, you can set the initial state in the
// constructor or by using an ES7 property initializer:
// https://babeljs.io/blog/2015/06/07/react-on-es6-plus#property-initializers
var illegalDefaults = (0, _intersection3.default)(autoControlledProps, (0, _keys3.default)(defaultProps));
if (!(0, _isEmpty3.default)(illegalDefaults)) {
console.error(['Do not set defaultProps for autoControlledProps. You can set defaults by', 'setting state in the constructor or using an ES7 property initializer', '(https://babeljs.io/blog/2015/06/07/react-on-es6-plus#property-initializers)', 'See ' + name + ' props: "' + illegalDefaults + '".'].join(' '));
}
// prevent listing defaultProps in autoControlledProps
//
// Default props are automatically handled.
// Listing defaults in autoControlledProps would result in allowing defaultDefaultValue props.
var illegalAutoControlled = (0, _filter3.default)(autoControlledProps, function (prop) {
return (0, _startsWith3.default)(prop, 'default');
});
if (!(0, _isEmpty3.default)(illegalAutoControlled)) {
console.error(['Do not add default props to autoControlledProps.', 'Default props are automatically handled.', 'See ' + name + ' autoControlledProps: "' + illegalAutoControlled + '".'].join(' '));
}
}
// Auto controlled props are copied to state.
// Set initial state by copying auto controlled props to state.
// Also look for the default prop for any auto controlled props (foo => defaultFoo)
// so we can set initial values from defaults.
var initialAutoControlledState = autoControlledProps.reduce(function (acc, prop) {
acc[prop] = getAutoControlledStateValue(prop, _this2.props, _this2.state, true);
if (process.env.NODE_ENV !== 'production') {
var defaultPropName = getDefaultPropName(prop);
var _name = _this2.constructor.name;
// prevent defaultFoo={} along side foo={}
if (defaultPropName in _this2.props && prop in _this2.props) {
console.error(_name + ' prop "' + prop + '" is auto controlled. Specify either ' + defaultPropName + ' or ' + prop + ', but not both.');
}
}
return acc;
}, {});
this.state = (0, _extends3.default)({}, this.state, initialAutoControlledState);
}
}, {
key: 'componentWillReceiveProps',
value: function componentWillReceiveProps(nextProps) {
var _this3 = this;
var autoControlledProps = this.constructor.autoControlledProps;
// Solve the next state for autoControlledProps
var newState = autoControlledProps.reduce(function (acc, prop) {
var isNextUndefined = (0, _isUndefined3.default)(nextProps[prop]);
var propWasRemoved = !(0, _isUndefined3.default)(_this3.props[prop]) && isNextUndefined;
// if next is defined then use its value
if (!isNextUndefined) acc[prop] = nextProps[prop];
// reinitialize state for props just removed / set undefined
else if (propWasRemoved) acc[prop] = getAutoControlledStateValue(prop, nextProps);
return acc;
}, {});
if (Object.keys(newState).length > 0) this.setState(newState);
}
/**
* Safely attempt to set state for props that might be controlled by the user.
* Second argument is a state object that is always passed to setState.
* @param {object} maybeState State that corresponds to controlled props.
* @param {object} [state] Actual state, useful when you also need to setState.
*/
}]);
return AutoControlledComponent;
}(_react.Component);
exports.default = AutoControlledComponent;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 8 1 1 1 1 1 1 1 1 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.isPrivate = exports.isChild = exports.isParent = exports.isModule = exports.isView = exports.isElement = exports.isCollection = exports.isAddon = exports.isType = exports.isMeta = exports.TYPES = undefined;
var _startsWith2 = require('lodash/fp/startsWith');
var _startsWith3 = _interopRequireDefault(_startsWith2);
var _has2 = require('lodash/fp/has');
var _has3 = _interopRequireDefault(_has2);
var _eq2 = require('lodash/fp/eq');
var _eq3 = _interopRequireDefault(_eq2);
var _flow2 = require('lodash/fp/flow');
var _flow3 = _interopRequireDefault(_flow2);
var _curry2 = require('lodash/fp/curry');
var _curry3 = _interopRequireDefault(_curry2);
var _get2 = require('lodash/fp/get');
var _get3 = _interopRequireDefault(_get2);
var _includes2 = require('lodash/fp/includes');
var _includes3 = _interopRequireDefault(_includes2);
var _values2 = require('lodash/fp/values');
var _values3 = _interopRequireDefault(_values2);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var TYPES = exports.TYPES = {
ADDON: 'addon',
COLLECTION: 'collection',
ELEMENT: 'element',
VIEW: 'view',
MODULE: 'module'
};
var TYPE_VALUES = (0, _values3.default)(TYPES);
/**
* Determine if an object qualifies as a META object.
* It must have the required keys and valid values.
* @private
* @param {Object} _meta A proposed component _meta object.
* @returns {Boolean}
*/
var isMeta = exports.isMeta = function isMeta(_meta) {
return (0, _includes3.default)((0, _get3.default)('type', _meta), TYPE_VALUES);
};
/**
* Extract a component's _meta object and optional key.
* Handles literal _meta objects, classes with _meta, objects with _meta
* @private
* @param {function|object} metaArg A class, a component instance, or meta object..
* @returns {object|string|undefined}
*/
var getMeta = function getMeta(metaArg) {
// literal
if (isMeta(metaArg)) return metaArg;
// from prop
else if (isMeta((0, _get3.default)('_meta', metaArg))) return metaArg._meta;
// from class
else if (isMeta((0, _get3.default)('constructor._meta', metaArg))) return metaArg.constructor._meta;
};
var metaHasKeyValue = (0, _curry3.default)(function (key, val, metaArg) {
return (0, _flow3.default)(getMeta, (0, _get3.default)(key), (0, _eq3.default)(val))(metaArg);
});
var isType = exports.isType = metaHasKeyValue('type');
// ----------------------------------------
// Export
// ----------------------------------------
// type
var isAddon = exports.isAddon = isType(TYPES.ADDON);
var isCollection = exports.isCollection = isType(TYPES.COLLECTION);
var isElement = exports.isElement = isType(TYPES.ELEMENT);
var isView = exports.isView = isType(TYPES.VIEW);
var isModule = exports.isModule = isType(TYPES.MODULE);
// parent
var isParent = exports.isParent = (0, _flow3.default)(getMeta, (0, _has3.default)('parent'), (0, _eq3.default)(false));
var isChild = exports.isChild = (0, _flow3.default)(getMeta, (0, _has3.default)('parent'));
// other
var isPrivate = exports.isPrivate = (0, _flow3.default)(getMeta, (0, _get3.default)('name'), (0, _startsWith3.default)('_'));
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 | 1 1 1 1 1 1 1 1 1 3 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.ALL_ICONS_IN_ALL_CONTEXTS = exports.COMPONENT_CONTEXT_SPECIFIC_ICONS = exports.ICONS_AND_ALIASES = exports.ICON_ALIASES = exports.ICONS = exports.NETWORKS_AND_WEBSITE_ICONS = exports.PAYMENT_OPTIONS_ICONS = exports.CURRENCY_ICONS = exports.TEXT_EDITOR_ICONS = exports.TABLES_ICONS = exports.MAP_LOCATIONS_TRANSPORTATION_ICONS = exports.AUDIO_ICONS = exports.RATING_ICONS = exports.TECHNOLOGIES_ICONS = exports.FILE_SYSTEM_ICONS = exports.COMPUTER_ICONS = exports.MOBILE_ICONS = exports.POINTERS_ICONS = exports.MEDIA_ICONS = exports.ITEM_SELECTION_ICONS = exports.SHAPES_ICONS = exports.LITERAL_OBJECTS_ICONS = exports.VIEW_ADJUSTMENT_ICONS = exports.ACCESSIBILITY_ICONS = exports.GENDER_SEXUALITY_ICONS = exports.USERS_ICONS = exports.MESSAGES_ICONS = exports.USER_ACTIONS_ICONS = exports.WEB_CONTENT_ICONS = exports.WIDTHS = exports.VISIBILITY = exports.VERTICAL_ALIGNMENTS = exports.TEXT_ALIGNMENTS = exports.SIZES = exports.FLOATS = exports.COLORS = undefined;
var _toConsumableArray2 = require('babel-runtime/helpers/toConsumableArray');
var _toConsumableArray3 = _interopRequireDefault(_toConsumableArray2);
var _values2 = require('lodash/values');
var _values3 = _interopRequireDefault(_values2);
var _keys2 = require('lodash/keys');
var _keys3 = _interopRequireDefault(_keys2);
var _numberToWord = require('./numberToWord');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var COLORS = exports.COLORS = ['red', 'orange', 'yellow', 'olive', 'green', 'teal', 'blue', 'violet', 'purple', 'pink', 'brown', 'grey', 'black'];
var FLOATS = exports.FLOATS = ['left', 'right'];
var SIZES = exports.SIZES = ['mini', 'tiny', 'small', 'medium', 'large', 'big', 'huge', 'massive'];
var TEXT_ALIGNMENTS = exports.TEXT_ALIGNMENTS = ['left', 'center', 'right', 'justified'];
var VERTICAL_ALIGNMENTS = exports.VERTICAL_ALIGNMENTS = ['bottom', 'middle', 'top'];
var VISIBILITY = exports.VISIBILITY = ['mobile', 'tablet', 'computer', 'large screen', 'widescreen'];
var WIDTHS = exports.WIDTHS = [].concat((0, _toConsumableArray3.default)((0, _keys3.default)(_numberToWord.numberToWordMap)), (0, _toConsumableArray3.default)((0, _keys3.default)(_numberToWord.numberToWordMap).map(Number)), (0, _toConsumableArray3.default)((0, _values3.default)(_numberToWord.numberToWordMap)));
// Generated from:
// https://github.com/Semantic-Org/Semantic-UI/blob/master/dist/components/icon.css
var WEB_CONTENT_ICONS = exports.WEB_CONTENT_ICONS = ['search', 'mail outline', 'signal', 'setting', 'home', 'inbox', 'browser', 'tag', 'tags', 'image', 'calendar', 'comment', 'shop', 'comments', 'external', 'privacy', 'settings', 'comments', 'external', 'trophy', 'payment', 'feed', 'alarm outline', 'tasks', 'cloud', 'lab', 'mail', 'dashboard', 'comment outline', 'comments outline', 'sitemap', 'idea', 'alarm', 'terminal', 'code', 'protect', 'calendar outline', 'ticket', 'external square', 'bug', 'mail square', 'history', 'options', 'text telephone', 'find', 'wifi', 'alarm mute', 'alarm mute outline', 'copyright', 'at', 'eyedropper', 'paint brush', 'heartbeat', 'mouse pointer', 'hourglass empty', 'hourglass start', 'hourglass half', 'hourglass end', 'hourglass full', 'hand pointer', 'trademark', 'registered', 'creative commons', 'add to calendar', 'remove from calendar', 'delete calendar', 'checked calendar', 'industry', 'shopping bag', 'shopping basket', 'hashtag', 'percent', 'address book', 'address book outline', 'address card', 'address card outline', 'id badge', 'id card', 'id card outline', 'podcast', 'window close', 'window close outline', 'window maximize', 'window minimize', 'window restore'];
var USER_ACTIONS_ICONS = exports.USER_ACTIONS_ICONS = ['wait', 'download', 'repeat', 'refresh', 'lock', 'bookmark', 'print', 'write', 'adjust', 'theme', 'edit', 'external share', 'ban', 'mail forward', 'share', 'expand', 'compress', 'unhide', 'hide', 'random', 'retweet', 'sign out', 'pin', 'sign in', 'upload', 'call', 'remove bookmark', 'call square', 'unlock', 'configure', 'filter', 'wizard', 'undo', 'exchange', 'cloud download', 'cloud upload', 'reply', 'reply all', 'erase', 'unlock alternate', 'write square', 'share square', 'archive', 'translate', 'recycle', 'send', 'send outline', 'share alternate', 'share alternate square', 'add to cart', 'in cart', 'add user', 'remove user', 'object group', 'object ungroup', 'clone', 'talk', 'talk outline'];
var MESSAGES_ICONS = exports.MESSAGES_ICONS = ['help circle', 'info circle', 'warning circle', 'warning sign', 'announcement', 'help', 'info', 'warning', 'birthday', 'help circle outline'];
var USERS_ICONS = exports.USERS_ICONS = ['user', 'users', 'doctor', 'handicap', 'student', 'child', 'spy', 'user circle', 'user circle outline', 'user outline'];
var GENDER_SEXUALITY_ICONS = exports.GENDER_SEXUALITY_ICONS = ['female', 'male', 'woman', 'man', 'non binary transgender', 'intergender', 'transgender', 'lesbian', 'gay', 'heterosexual', 'other gender', 'other gender vertical', 'other gender horizontal', 'neuter', 'genderless'];
var ACCESSIBILITY_ICONS = exports.ACCESSIBILITY_ICONS = ['universal access', 'wheelchair', 'blind', 'audio description', 'volume control phone', 'braille', 'asl', 'assistive listening systems', 'deafness', 'sign language', 'low vision'];
var VIEW_ADJUSTMENT_ICONS = exports.VIEW_ADJUSTMENT_ICONS = ['block layout', 'grid layout', 'list layout', 'zoom', 'zoom out', 'resize vertical', 'resize horizontal', 'maximize', 'crop'];
var LITERAL_OBJECTS_ICONS = exports.LITERAL_OBJECTS_ICONS = ['cocktail', 'road', 'flag', 'book', 'gift', 'leaf', 'fire', 'plane', 'magnet', 'lemon', 'world', 'travel', 'shipping', 'money', 'legal', 'lightning', 'umbrella', 'treatment', 'suitcase', 'bar', 'flag outline', 'flag checkered', 'puzzle', 'fire extinguisher', 'rocket', 'anchor', 'bullseye', 'sun', 'moon', 'fax', 'life ring', 'bomb', 'soccer', 'calculator', 'diamond', 'sticky note', 'sticky note outline', 'law', 'hand peace', 'hand rock', 'hand paper', 'hand scissors', 'hand lizard', 'hand spock', 'tv', 'thermometer empty', 'thermometer full', 'thermometer half', 'thermometer quarter', 'thermometer three quarters', 'bath', 'snowflake outline'];
var SHAPES_ICONS = exports.SHAPES_ICONS = ['crosshairs', 'asterisk', 'square outline', 'certificate', 'square', 'quote left', 'quote right', 'spinner', 'circle', 'ellipsis horizontal', 'ellipsis vertical', 'cube', 'cubes', 'circle notched', 'circle thin'];
var ITEM_SELECTION_ICONS = exports.ITEM_SELECTION_ICONS = ['checkmark', 'remove', 'checkmark box', 'move', 'add circle', 'minus circle', 'remove circle', 'check circle', 'remove circle outline', 'check circle outline', 'plus', 'minus', 'add square', 'radio', 'minus square', 'minus square outline', 'check square', 'selected radio', 'plus square outline', 'toggle off', 'toggle on'];
var MEDIA_ICONS = exports.MEDIA_ICONS = ['film', 'sound', 'photo', 'bar chart', 'camera retro', 'newspaper', 'area chart', 'pie chart', 'line chart'];
var POINTERS_ICONS = exports.POINTERS_ICONS = ['arrow circle outline down', 'arrow circle outline up', 'chevron left', 'chevron right', 'arrow left', 'arrow right', 'arrow up', 'arrow down', 'chevron up', 'chevron down', 'pointing right', 'pointing left', 'pointing up', 'pointing down', 'arrow circle left', 'arrow circle right', 'arrow circle up', 'arrow circle down', 'caret down', 'caret up', 'caret left', 'caret right', 'angle double left', 'angle double right', 'angle double up', 'angle double down', 'angle left', 'angle right', 'angle up', 'angle down', 'chevron circle left', 'chevron circle right', 'chevron circle up', 'chevron circle down', 'toggle down', 'toggle up', 'toggle right', 'long arrow down', 'long arrow up', 'long arrow left', 'long arrow right', 'arrow circle outline right', 'arrow circle outline left', 'toggle left'];
var MOBILE_ICONS = exports.MOBILE_ICONS = ['tablet', 'mobile', 'battery full', 'battery high', 'battery medium', 'battery low', 'battery empty'];
var COMPUTER_ICONS = exports.COMPUTER_ICONS = ['power', 'trash outline', 'disk outline', 'desktop', 'laptop', 'game', 'keyboard', 'plug'];
var FILE_SYSTEM_ICONS = exports.FILE_SYSTEM_ICONS = ['trash', 'file outline', 'folder', 'folder open', 'file text outline', 'folder outline', 'folder open outline', 'level up', 'level down', 'file', 'file text', 'file pdf outline', 'file word outline', 'file excel outline', 'file powerpoint outline', 'file image outline', 'file archive outline', 'file audio outline', 'file video outline', 'file code outline'];
var TECHNOLOGIES_ICONS = exports.TECHNOLOGIES_ICONS = ['qrcode', 'barcode', 'rss', 'fork', 'html5', 'css3', 'rss square', 'openid', 'database', 'server', 'usb', 'bluetooth', 'bluetooth alternative', 'microchip'];
var RATING_ICONS = exports.RATING_ICONS = ['heart', 'star', 'empty star', 'thumbs outline up', 'thumbs outline down', 'star half', 'empty heart', 'smile', 'frown', 'meh', 'star half empty', 'thumbs up', 'thumbs down'];
var AUDIO_ICONS = exports.AUDIO_ICONS = ['music', 'video play outline', 'volume off', 'volume down', 'volume up', 'record', 'step backward', 'fast backward', 'backward', 'play', 'pause', 'stop', 'forward', 'fast forward', 'step forward', 'eject', 'unmute', 'mute', 'video play', 'closed captioning', 'pause circle', 'pause circle outline', 'stop circle', 'stop circle outline'];
var MAP_LOCATIONS_TRANSPORTATION_ICONS = exports.MAP_LOCATIONS_TRANSPORTATION_ICONS = ['marker', 'coffee', 'food', 'building outline', 'hospital', 'emergency', 'first aid', 'military', 'h', 'location arrow', 'compass', 'space shuttle', 'university', 'building', 'paw', 'spoon', 'car', 'taxi', 'tree', 'bicycle', 'bus', 'ship', 'motorcycle', 'street view', 'hotel', 'train', 'subway', 'map pin', 'map signs', 'map outline', 'map'];
var TABLES_ICONS = exports.TABLES_ICONS = ['table', 'columns', 'sort', 'sort descending', 'sort ascending', 'sort alphabet ascending', 'sort alphabet descending', 'sort content ascending', 'sort content descending', 'sort numeric ascending', 'sort numeric descending'];
var TEXT_EDITOR_ICONS = exports.TEXT_EDITOR_ICONS = ['font', 'bold', 'italic', 'text height', 'text width', 'align left', 'align center', 'align right', 'align justify', 'list', 'outdent', 'indent', 'linkify', 'cut', 'copy', 'attach', 'save', 'content', 'unordered list', 'ordered list', 'strikethrough', 'underline', 'paste', 'unlinkify', 'superscript', 'subscript', 'header', 'paragraph', 'text cursor'];
var CURRENCY_ICONS = exports.CURRENCY_ICONS = ['euro', 'pound', 'dollar', 'rupee', 'yen', 'ruble', 'won', 'bitcoin', 'lira', 'shekel'];
var PAYMENT_OPTIONS_ICONS = exports.PAYMENT_OPTIONS_ICONS = ['paypal', 'google wallet', 'visa', 'mastercard', 'discover', 'american express', 'paypal card', 'stripe', 'japan credit bureau', 'diners club', 'credit card alternative'];
var NETWORKS_AND_WEBSITE_ICONS = exports.NETWORKS_AND_WEBSITE_ICONS = ['twitter square', 'facebook square', 'linkedin square', 'github square', 'twitter', 'facebook f', 'github', 'pinterest', 'pinterest square', 'google plus square', 'google plus', 'linkedin', 'github alternate', 'maxcdn', 'youtube square', 'youtube', 'xing', 'xing square', 'youtube play', 'dropbox', 'stack overflow', 'instagram', 'flickr', 'adn', 'bitbucket', 'bitbucket square', 'tumblr', 'tumblr square', 'apple', 'windows', 'android', 'linux', 'dribble', 'skype', 'foursquare', 'trello', 'gittip', 'vk', 'weibo', 'renren', 'pagelines', 'stack exchange', 'vimeo square', 'slack', 'wordpress', 'yahoo', 'google', 'reddit', 'reddit square', 'stumbleupon circle', 'stumbleupon', 'delicious', 'digg', 'pied piper', 'pied piper alternate', 'drupal', 'joomla', 'behance', 'behance square', 'steam', 'steam square', 'spotify', 'deviantart', 'soundcloud', 'vine', 'codepen', 'jsfiddle', 'rebel', 'empire', 'git square', 'git', 'hacker news', 'tencent weibo', 'qq', 'wechat', 'slideshare', 'twitch', 'yelp', 'lastfm', 'lastfm square', 'ioxhost', 'angellist', 'meanpath', 'buysellads', 'connectdevelop', 'dashcube', 'forumbee', 'leanpub', 'sellsy', 'shirtsinbulk', 'simplybuilt', 'skyatlas', 'facebook', 'pinterest', 'whatsapp', 'viacoin', 'medium', 'y combinator', 'optinmonster', 'opencart', 'expeditedssl', 'gg', 'gg circle', 'tripadvisor', 'odnoklassniki', 'odnoklassniki square', 'pocket', 'wikipedia', 'safari', 'chrome', 'firefox', 'opera', 'internet explorer', 'contao', '500px', 'amazon', 'houzz', 'vimeo', 'black tie', 'fonticons', 'reddit alien', 'microsoft edge', 'codiepie', 'modx', 'fort awesome', 'product hunt', 'mixcloud', 'scribd', 'gitlab', 'wpbeginner', 'wpforms', 'envira gallery', 'glide', 'glide g', 'viadeo', 'viadeo square', 'snapchat', 'snapchat ghost', 'snapchat square', 'pied piper hat', 'first order', 'yoast', 'themeisle', 'google plus circle', 'font awesome', 'bandcamp', 'eercast', 'etsy', 'free code camp', 'grav', 'imdb', 'linode', 'meetup', 'quora', 'ravelry', 'superpowers', 'telegram', 'wpexplorer'];
var ICONS = exports.ICONS = [].concat(WEB_CONTENT_ICONS, USER_ACTIONS_ICONS, MESSAGES_ICONS, USERS_ICONS, GENDER_SEXUALITY_ICONS, ACCESSIBILITY_ICONS, VIEW_ADJUSTMENT_ICONS, LITERAL_OBJECTS_ICONS, SHAPES_ICONS, ITEM_SELECTION_ICONS, MEDIA_ICONS, POINTERS_ICONS, MOBILE_ICONS, COMPUTER_ICONS, FILE_SYSTEM_ICONS, TECHNOLOGIES_ICONS, RATING_ICONS, AUDIO_ICONS, MAP_LOCATIONS_TRANSPORTATION_ICONS, TABLES_ICONS, TEXT_EDITOR_ICONS, CURRENCY_ICONS, PAYMENT_OPTIONS_ICONS, NETWORKS_AND_WEBSITE_ICONS);
var ICON_ALIASES = exports.ICON_ALIASES = ['like', 'favorite', 'video', 'check', 'close', 'cancel', 'delete', 'x', 'zoom in', 'magnify', 'shutdown', 'clock', 'time', 'play circle outline', 'headphone', 'camera', 'video camera', 'picture', 'pencil', 'compose', 'point', 'tint', 'signup', 'plus circle', 'question circle', 'dont', 'minimize', 'add', 'exclamation circle', 'attention', 'eye', 'exclamation triangle', 'shuffle', 'chat', 'cart', 'shopping cart', 'bar graph', 'key', 'cogs', 'discussions', 'like outline', 'dislike outline', 'heart outline', 'log out', 'thumb tack', 'winner', 'phone', 'bookmark outline', 'phone square', 'credit card', 'hdd outline', 'bullhorn', 'bell outline', 'hand outline right', 'hand outline left', 'hand outline up', 'hand outline down', 'globe', 'wrench', 'briefcase', 'group', 'linkify', 'chain', 'flask', 'sidebar', 'bars', 'list ul', 'list ol', 'numbered list', 'magic', 'truck', 'currency', 'triangle down', 'dropdown', 'triangle up', 'triangle left', 'triangle right', 'envelope', 'conversation', 'rain', 'clipboard', 'lightbulb', 'bell', 'ambulance', 'medkit', 'fighter jet', 'beer', 'plus square', 'computer', 'circle outline', 'gamepad', 'star half full', 'broken chain', 'question', 'exclamation', 'eraser', 'microphone', 'microphone slash', 'shield', 'target', 'play circle', 'pencil square', 'eur', 'gbp', 'usd', 'inr', 'cny', 'rmb', 'jpy', 'rouble', 'rub', 'krw', 'btc', 'gratipay', 'zip', 'dot circle outline', 'try', 'graduation', 'circle outline', 'sliders', 'weixin', 'tty', 'teletype', 'binoculars', 'power cord', 'wifi', 'visa card', 'mastercard card', 'discover card', 'amex', 'american express card', 'stripe card', 'bell slash', 'bell slash outline', 'area graph', 'pie graph', 'line graph', 'cc', 'sheqel', 'ils', 'plus cart', 'arrow down cart', 'detective', 'venus', 'mars', 'mercury', 'intersex', 'venus double', 'female homosexual', 'mars double', 'male homosexual', 'venus mars', 'mars stroke', 'mars alternate', 'mars vertical', 'mars stroke vertical', 'mars horizontal', 'mars stroke horizontal', 'asexual', 'facebook official', 'user plus', 'user times', 'user close', 'user cancel', 'user delete', 'user x', 'bed', 'yc', 'ycombinator', 'battery four', 'battery three', 'battery three quarters', 'battery two', 'battery half', 'battery one', 'battery quarter', 'battery zero', 'i cursor', 'jcb', 'japan credit bureau card', 'diners club card', 'balance', 'hourglass outline', 'hourglass zero', 'hourglass one', 'hourglass two', 'hourglass three', 'hourglass four', 'grab', 'hand victory', 'tm', 'r circle', 'television', 'five hundred pixels', 'calendar plus', 'calendar minus', 'calendar times', 'calendar check', 'factory', 'commenting', 'commenting outline', 'edge', 'ms edge', 'wordpress beginner', 'wordpress forms', 'envira', 'question circle outline', 'assistive listening devices', 'als', 'ald', 'asl interpreting', 'deaf', 'american sign language interpreting', 'hard of hearing', 'signing', 'new pied piper', 'theme isle', 'google plus official', 'fa', 'bathtub', 'drivers license', 'drivers license outline', 's15', 'thermometer', 'times rectangle', 'times rectangle outline', 'vcard', 'vcard outline'];
var ICONS_AND_ALIASES = exports.ICONS_AND_ALIASES = [].concat((0, _toConsumableArray3.default)(ICONS), ICON_ALIASES);
// Some icon names are not part of icons.css.
// These are only valid as children of other components.
// Their CSS rules are defined by a specific component's CSS.
// We don't want to show name warnings for those usages so we add them as valid names here.
var COMPONENT_CONTEXT_SPECIFIC_ICONS = exports.COMPONENT_CONTEXT_SPECIFIC_ICONS = ['left dropdown'];
var ALL_ICONS_IN_ALL_CONTEXTS = exports.ALL_ICONS_IN_ALL_CONTEXTS = [].concat((0, _toConsumableArray3.default)(ICONS_AND_ALIASES), COMPONENT_CONTEXT_SPECIFIC_ICONS);
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 | 1 1 1 1 1 1 1 2 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.findByType = exports.someByType = undefined;
var _find2 = require('lodash/find');
var _find3 = _interopRequireDefault(_find2);
var _some2 = require('lodash/some');
var _some3 = _interopRequireDefault(_some2);
var _react = require('react');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* Determine if child by type exists in children.
* @param {Object} children The children prop of a component.
* @param {string|Function} type An html tag name string or React component.
* @returns {Boolean}
*/
var someByType = exports.someByType = function someByType(children, type) {
return (0, _some3.default)(_react.Children.toArray(children), { type: type });
};
/**
* Find child by type.
* @param {Object} children The children prop of a component.
* @param {string|Function} type An html tag name string or React component.
* @returns {undefined|Object}
*/
var findByType = exports.findByType = function findByType(children, type) {
return (0, _find3.default)(_react.Children.toArray(children), { type: type });
};
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 | 1 1 1 1 1 1 1 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.useWidthProp = exports.useVerticalAlignProp = exports.useTextAlignProp = exports.useOnlyProp = exports.useKeyOrValueAndKey = exports.useValueAndKey = exports.useKeyOnly = undefined;
var _typeof2 = require('babel-runtime/helpers/typeof');
var _typeof3 = _interopRequireDefault(_typeof2);
var _numberToWord = require('./numberToWord');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/*
* There are 3 prop patterns used to build up the className for a component.
* Each utility here is meant for use in a classnames() argument.
*
* There is no util for valueOnly() because it would simply return val.
* Use the prop value inline instead.
* <Label size='big' />
* <div class="ui big label"></div>
*/
/**
* Props where only the prop key is used in the className.
* @param {*} val A props value
* @param {string} key A props key
*
* @example
* <Label tag />
* <div class="ui tag label"></div>
*/
var useKeyOnly = exports.useKeyOnly = function useKeyOnly(val, key) {
return val && key;
};
/**
* Props that require both a key and value to create a className.
* @param {*} val A props value
* @param {string} key A props key
*
* @example
* <Label corner='left' />
* <div class="ui left corner label"></div>
*/
var useValueAndKey = exports.useValueAndKey = function useValueAndKey(val, key) {
return val && val !== true && val + ' ' + key;
};
/**
* Props whose key will be used in className, or value and key.
* @param {*} val A props value
* @param {string} key A props key
*
* @example Key Only
* <Label pointing />
* <div class="ui pointing label"></div>
*
* @example Key and Value
* <Label pointing='left' />
* <div class="ui left pointing label"></div>
*/
var useKeyOrValueAndKey = exports.useKeyOrValueAndKey = function useKeyOrValueAndKey(val, key) {
return val && (val === true ? key : val + ' ' + key);
};
//
// Prop to className exceptions
//
/**
* The "only" prop implements control of visibility classes for Grid subcomponents.
*
* @param {*} val The value of the "only" prop
*
* @example
* <Grid.Row only='mobile' />
* <Grid.Row only='mobile tablet' />
* <div class="mobile only row"></div>
* <div class="mobile only tablet only row"></div>
*/
var useOnlyProp = exports.useOnlyProp = function useOnlyProp(val) {
if (!val || val === true) return null;
return val.replace('large screen', 'large-screen').split(' ').map(function (prop) {
return prop.replace('-', ' ') + ' only';
}).join(' ');
};
/**
* The "textAlign" prop follows the useValueAndKey except when the value is "justified'.
* In this case, only the class "justified" is used, ignoring the "aligned" class.
* @param {*} val The value of the "textAlign" prop
*
* @example
* <Container textAlign='justified' />
* <div class="ui justified container"></div>
*
* @example
* <Container textAlign='left' />
* <div class="ui left aligned container"></div>
*/
var useTextAlignProp = exports.useTextAlignProp = function useTextAlignProp(val) {
return val === 'justified' ? 'justified' : useValueAndKey(val, 'aligned');
};
/**
* The "verticalAlign" prop follows the useValueAndKey.
*
* @param {*} val The value of the "verticalAlign" prop
*
* @example
* <Grid verticalAlign='middle' />
* <div class="ui middle aligned grid"></div>
*/
var useVerticalAlignProp = exports.useVerticalAlignProp = function useVerticalAlignProp(val) {
return useValueAndKey(val, 'aligned');
};
/**
* Create "X", "X wide" and "equal width" classNames.
* "X" is a numberToWord value and "wide" is configurable.
* @param {*} val The prop value
* @param {string} [widthClass=''] The class
* @param {boolean} [canEqual=false] Flag that indicates possibility of "equal" value
*
* @example
* <Grid columns='equal' />
* <div class="ui equal width grid"></div>
*
* <Form widths='equal' />
* <div class="ui equal width form"></div>
*
* <FieldGroup widths='equal' />
* <div class="equal width fields"></div>
*
* @example
* <Grid columns={4} />
* <div class="ui four column grid"></div>
*/
var useWidthProp = exports.useWidthProp = function useWidthProp(val) {
var widthClass = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : '';
var canEqual = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
if (canEqual && val === 'equal') {
return 'equal width';
}
var valType = typeof val === 'undefined' ? 'undefined' : (0, _typeof3.default)(val);
if ((valType === 'string' || valType === 'number') && widthClass) {
return (0, _numberToWord.numberToWord)(val) + ' ' + widthClass;
}
return (0, _numberToWord.numberToWord)(val);
};
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 | 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 19 1 1 1 2 1 32 1 41 1 3 1 2 1 15 1 2 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.deprecate = exports.collectionShorthand = exports.itemShorthand = exports.contentShorthand = exports.onlyProp = exports.demand = exports.givenProps = exports.some = exports.every = exports.disallow = exports.suggest = exports.as = undefined;
var _toConsumableArray2 = require('babel-runtime/helpers/toConsumableArray');
var _toConsumableArray3 = _interopRequireDefault(_toConsumableArray2);
var _difference2 = require('lodash/fp/difference');
var _difference3 = _interopRequireDefault(_difference2);
var _trim2 = require('lodash/fp/trim');
var _trim3 = _interopRequireDefault(_trim2);
var _isObject2 = require('lodash/fp/isObject');
var _isObject3 = _interopRequireDefault(_isObject2);
var _pick2 = require('lodash/fp/pick');
var _pick3 = _interopRequireDefault(_pick2);
var _keys2 = require('lodash/fp/keys');
var _keys3 = _interopRequireDefault(_keys2);
var _isPlainObject2 = require('lodash/fp/isPlainObject');
var _isPlainObject3 = _interopRequireDefault(_isPlainObject2);
var _isFunction2 = require('lodash/fp/isFunction');
var _isFunction3 = _interopRequireDefault(_isFunction2);
var _compact2 = require('lodash/fp/compact');
var _compact3 = _interopRequireDefault(_compact2);
var _take2 = require('lodash/fp/take');
var _take3 = _interopRequireDefault(_take2);
var _sortBy2 = require('lodash/fp/sortBy');
var _sortBy3 = _interopRequireDefault(_sortBy2);
var _sum2 = require('lodash/fp/sum');
var _sum3 = _interopRequireDefault(_sum2);
var _min2 = require('lodash/fp/min');
var _min3 = _interopRequireDefault(_min2);
var _map2 = require('lodash/fp/map');
var _map3 = _interopRequireDefault(_map2);
var _flow2 = require('lodash/fp/flow');
var _flow3 = _interopRequireDefault(_flow2);
var _includes2 = require('lodash/fp/includes');
var _includes3 = _interopRequireDefault(_includes2);
var _isNil2 = require('lodash/fp/isNil');
var _isNil3 = _interopRequireDefault(_isNil2);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _leven = require('./leven');
var _leven2 = _interopRequireDefault(_leven);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var typeOf = function typeOf() {
var _Object$prototype$toS;
return (_Object$prototype$toS = Object.prototype.toString).call.apply(_Object$prototype$toS, arguments);
};
/**
* Ensure a component can render as a give prop value.
*/
var as = exports.as = function as() {
return _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.func]).apply(undefined, arguments);
};
/**
* Similar to PropTypes.oneOf but shows closest matches.
* Word order is ignored allowing `left chevron` to match `chevron left`.
* Useful for very large lists of options (e.g. Icon name, Flag name, etc.)
* @param {string[]} suggestions An array of allowed values.
*/
var suggest = exports.suggest = function suggest(suggestions) {
return function (props, propName, componentName) {
if (!Array.isArray(suggestions)) {
throw new Error(['Invalid argument supplied to suggest, expected an instance of array.', ' See `' + propName + '` prop in `' + componentName + '`.'].join(''));
}
var propValue = props[propName];
// skip if prop is undefined or is included in the suggestions
if ((0, _isNil3.default)(propValue) || propValue === false || (0, _includes3.default)(propValue, suggestions)) return;
// find best suggestions
var propValueWords = propValue.split(' ');
/* eslint-disable max-nested-callbacks */
var bestMatches = (0, _flow3.default)((0, _map3.default)(function (suggestion) {
var suggestionWords = suggestion.split(' ');
var propValueScore = (0, _flow3.default)((0, _map3.default)(function (x) {
return (0, _map3.default)(function (y) {
return (0, _leven2.default)(x, y);
}, suggestionWords);
}), (0, _map3.default)(_min3.default), _sum3.default)(propValueWords);
var suggestionScore = (0, _flow3.default)((0, _map3.default)(function (x) {
return (0, _map3.default)(function (y) {
return (0, _leven2.default)(x, y);
}, propValueWords);
}), (0, _map3.default)(_min3.default), _sum3.default)(suggestionWords);
return { suggestion: suggestion, score: propValueScore + suggestionScore };
}), (0, _sortBy3.default)(['score', 'suggestion']), (0, _take3.default)(3))(suggestions);
/* eslint-enable max-nested-callbacks */
// skip if a match scored 0
// since we're matching on words (classNames) this allows any word order to pass validation
// e.g. `left chevron` vs `chevron left`
if (bestMatches.some(function (x) {
return x.score === 0;
})) return;
return new Error(['Invalid prop `' + propName + '` of value `' + propValue + '` supplied to `' + componentName + '`.', '\n\nInstead of `' + propValue + '`, did you mean:', bestMatches.map(function (x) {
return '\n - ' + x.suggestion;
}).join(''), '\n'].join(''));
};
};
/**
* Disallow other props form being defined with this prop.
* @param {string[]} disallowedProps An array of props that cannot be used with this prop.
*/
var disallow = exports.disallow = function disallow(disallowedProps) {
return function (props, propName, componentName) {
if (!Array.isArray(disallowedProps)) {
throw new Error(['Invalid argument supplied to disallow, expected an instance of array.', ' See `' + propName + '` prop in `' + componentName + '`.'].join(''));
}
// skip if prop is undefined
if ((0, _isNil3.default)(props[propName]) || props[propName] === false) return;
// find disallowed props with values
var disallowed = disallowedProps.reduce(function (acc, disallowedProp) {
if (!(0, _isNil3.default)(props[disallowedProp]) && props[disallowedProp] !== false) {
return [].concat((0, _toConsumableArray3.default)(acc), [disallowedProp]);
}
return acc;
}, []);
if (disallowed.length > 0) {
return new Error(['Prop `' + propName + '` in `' + componentName + '` conflicts with props: `' + disallowed.join('`, `') + '`.', 'They cannot be defined together, choose one or the other.'].join(' '));
}
};
};
/**
* Ensure a prop adherers to multiple prop type validators.
* @param {function[]} validators An array of propType functions.
*/
var every = exports.every = function every(validators) {
return function (props, propName, componentName) {
for (var _len = arguments.length, rest = Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {
rest[_key - 3] = arguments[_key];
}
if (!Array.isArray(validators)) {
throw new Error(['Invalid argument supplied to every, expected an instance of array.', 'See `' + propName + '` prop in `' + componentName + '`.'].join(' '));
}
var errors = (0, _flow3.default)((0, _map3.default)(function (validator) {
if (typeof validator !== 'function') {
throw new Error('every() argument "validators" should contain functions, found: ' + typeOf(validator) + '.');
}
return validator.apply(undefined, [props, propName, componentName].concat(rest));
}), _compact3.default)(validators);
// we can only return one error at a time
return errors[0];
};
};
/**
* Ensure a prop adherers to at least one of the given prop type validators.
* @param {function[]} validators An array of propType functions.
*/
var some = exports.some = function some(validators) {
return function (props, propName, componentName) {
for (var _len2 = arguments.length, rest = Array(_len2 > 3 ? _len2 - 3 : 0), _key2 = 3; _key2 < _len2; _key2++) {
rest[_key2 - 3] = arguments[_key2];
}
if (!Array.isArray(validators)) {
throw new Error(['Invalid argument supplied to some, expected an instance of array.', 'See `' + propName + '` prop in `' + componentName + '`.'].join(' '));
}
var errors = (0, _compact3.default)((0, _map3.default)(validators, function (validator) {
if (!(0, _isFunction3.default)(validator)) {
throw new Error('some() argument "validators" should contain functions, found: ' + typeOf(validator) + '.');
}
return validator.apply(undefined, [props, propName, componentName].concat(rest));
}));
// fail only if all validators failed
if (errors.length === validators.length) {
var error = new Error('One of these validators must pass:');
error.message += '\n' + (0, _map3.default)(errors, function (err, i) {
return '[' + (i + 1) + ']: ' + err.message;
}).join('\n');
return error;
}
};
};
/**
* Ensure a validator passes only when a component has a given propsShape.
* @param {object} propsShape An object describing the prop shape.
* @param {function} validator A propType function.
*/
var givenProps = exports.givenProps = function givenProps(propsShape, validator) {
return function (props, propName, componentName) {
for (var _len3 = arguments.length, rest = Array(_len3 > 3 ? _len3 - 3 : 0), _key3 = 3; _key3 < _len3; _key3++) {
rest[_key3 - 3] = arguments[_key3];
}
if (!(0, _isPlainObject3.default)(propsShape)) {
throw new Error(['Invalid argument supplied to givenProps, expected an object.', 'See `' + propName + '` prop in `' + componentName + '`.'].join(' '));
}
if (typeof validator !== 'function') {
throw new Error(['Invalid argument supplied to givenProps, expected a function.', 'See `' + propName + '` prop in `' + componentName + '`.'].join(' '));
}
var shouldValidate = (0, _keys3.default)(propsShape).every(function (key) {
var val = propsShape[key];
// require propShape validators to pass or prop values to match
return typeof val === 'function' ? !val.apply(undefined, [props, key, componentName].concat(rest)) : val === props[propName];
});
if (!shouldValidate) return;
var error = validator.apply(undefined, [props, propName, componentName].concat(rest));
if (error) {
// poor mans shallow pretty print, prevents JSON circular reference errors
var prettyProps = '{ ' + (0, _keys3.default)((0, _pick3.default)((0, _keys3.default)(propsShape), props)).map(function (key) {
var val = props[key];
var renderedValue = val;
if (typeof val === 'string') renderedValue = '"' + val + '"';else if (Array.isArray(val)) renderedValue = '[' + val.join(', ') + ']';else if ((0, _isObject3.default)(val)) renderedValue = '{...}';
return key + ': ' + renderedValue;
}).join(', ') + ' }';
error.message = 'Given props ' + prettyProps + ': ' + error.message;
return error;
}
};
};
/**
* Define prop dependencies by requiring other props.
* @param {string[]} requiredProps An array of required prop names.
*/
var demand = exports.demand = function demand(requiredProps) {
return function (props, propName, componentName) {
if (!Array.isArray(requiredProps)) {
throw new Error(['Invalid `requiredProps` argument supplied to require, expected an instance of array.', ' See `' + propName + '` prop in `' + componentName + '`.'].join(''));
}
// skip if prop is undefined
if (props[propName] === undefined) return;
var missingRequired = requiredProps.filter(function (requiredProp) {
return props[requiredProp] === undefined;
});
if (missingRequired.length > 0) {
return new Error('`' + propName + '` prop in `' + componentName + '` requires props: `' + missingRequired.join('`, `') + '`.');
}
};
};
/**
* Ensure an only prop contains a string with only possible values.
* @param {string[]} possible An array of possible values to prop.
*/
var onlyProp = exports.onlyProp = function onlyProp(possible) {
return function (props, propName, componentName) {
if (!Array.isArray(possible)) {
throw new Error(['Invalid argument supplied to some, expected an instance of array.', 'See `' + propName + '` prop in `' + componentName + '`.'].join(' '));
}
var propValue = props[propName];
// skip if prop is undefined
if ((0, _isNil3.default)(propValue) || propValue === false) return;
var values = propValue.replace('large screen', 'large-screen').split(' ').map(function (val) {
return (0, _trim3.default)(val).replace('-', ' ');
});
var invalid = (0, _difference3.default)(values, possible);
// fail only if there are invalid values
if (invalid.length > 0) {
return new Error('`' + propName + '` prop in `' + componentName + '` has invalid values: `' + invalid.join('`, `') + '`.');
}
};
};
/**
* Ensure a component can render as a node passed as a prop value in place of children.
*/
var contentShorthand = exports.contentShorthand = function contentShorthand() {
return every([disallow(['children']), _propTypes2.default.node]).apply(undefined, arguments);
};
/**
* Item shorthand is a description of a component that can be a literal,
* a props object, or an element.
*/
var itemShorthand = exports.itemShorthand = function itemShorthand() {
return every([disallow(['children']), _propTypes2.default.oneOfType([_propTypes2.default.array, _propTypes2.default.node, _propTypes2.default.object])]).apply(undefined, arguments);
};
/**
* Collection shorthand ensures a prop is an array of item shorthand.
*/
var collectionShorthand = exports.collectionShorthand = function collectionShorthand() {
return every([disallow(['children']), _propTypes2.default.arrayOf(itemShorthand)]).apply(undefined, arguments);
};
/**
* Show a deprecated warning for component props with a help message and optional validator.
* @param {string} help A help message to display with the deprecation warning.
* @param {function} [validator] A propType function.
*/
var deprecate = exports.deprecate = function deprecate(help, validator) {
return function (props, propName, componentName) {
for (var _len4 = arguments.length, args = Array(_len4 > 3 ? _len4 - 3 : 0), _key4 = 3; _key4 < _len4; _key4++) {
args[_key4 - 3] = arguments[_key4];
}
if (typeof help !== 'string') {
throw new Error(['Invalid `help` argument supplied to deprecate, expected a string.', 'See `' + propName + '` prop in `' + componentName + '`.'].join(' '));
}
// skip if prop is undefined
if (props[propName] === undefined) return;
// deprecation error and help
var error = new Error('The `' + propName + '` prop in `' + componentName + '` is deprecated.');
if (help) error.message += ' ' + help;
// add optional validation error message
if (validator) {
if (typeof validator === 'function') {
var validationError = validator.apply(undefined, [props, propName, componentName].concat(args));
if (validationError) {
error.message = error.message + ' ' + validationError.message;
}
} else {
throw new Error(['Invalid argument supplied to deprecate, expected a function.', 'See `' + propName + '` prop in `' + componentName + '`.'].join(' '));
}
}
return error;
};
};
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 | 1 1 1 1 1 1 1 1 1 8 1 8 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.debug = exports.makeDebugger = undefined;
var _isBrowser = require('./isBrowser');
var _isBrowser2 = _interopRequireDefault(_isBrowser);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var _debug = void 0;
var noop = function noop() {
return undefined;
};
Iif (_isBrowser2.default && process.env.NODE_ENV !== 'production' && process.env.NODE_ENV !== 'test') {
// Heads Up!
// https://github.com/visionmedia/debug/pull/331
//
// debug now clears storage on load, grab the debug settings before require('debug').
// We try/catch here as Safari throws on localStorage access in private mode or with cookies disabled.
var DEBUG = void 0;
try {
DEBUG = window.localStorage.debug;
} catch (e) {
/* eslint-disable no-console */
console.error('Semantic-UI-React could not enable debug.');
console.error(e);
/* eslint-enable no-console */
}
_debug = require('debug');
// enable what ever settings we got from storage
_debug.enable(DEBUG);
} else {
_debug = function _debug() {
return noop;
};
}
/**
* Create a namespaced debug function.
* @param {String} namespace Usually a component name.
* @example
* import { makeDebugger } from 'src/lib'
* const debug = makeDebugger('namespace')
*
* debug('Some message')
* @returns {Function}
*/
var makeDebugger = exports.makeDebugger = function makeDebugger(namespace) {
return _debug('semanticUIReact:' + namespace);
};
/**
* Default debugger, simple log.
* @example
* import { debug } from 'src/lib'
* debug('Some message')
*/
var debug = exports.debug = makeDebugger('log');
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 | 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 12 1 1 1 38 38 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.createHTMLParagraph = exports.createHTMLLabel = exports.createHTMLInput = exports.createHTMLImage = exports.createHTMLDivision = undefined;
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _typeof2 = require('babel-runtime/helpers/typeof');
var _typeof3 = _interopRequireDefault(_typeof2);
var _uniq2 = require('lodash/uniq');
var _uniq3 = _interopRequireDefault(_uniq2);
var _isFunction2 = require('lodash/isFunction');
var _isFunction3 = _interopRequireDefault(_isFunction2);
var _isArray2 = require('lodash/isArray');
var _isArray3 = _interopRequireDefault(_isArray2);
var _isPlainObject2 = require('lodash/isPlainObject');
var _isPlainObject3 = _interopRequireDefault(_isPlainObject2);
var _isNumber2 = require('lodash/isNumber');
var _isNumber3 = _interopRequireDefault(_isNumber2);
var _isString2 = require('lodash/isString');
var _isString3 = _interopRequireDefault(_isString2);
var _isBoolean2 = require('lodash/isBoolean');
var _isBoolean3 = _interopRequireDefault(_isBoolean2);
var _isNil2 = require('lodash/isNil');
var _isNil3 = _interopRequireDefault(_isNil2);
exports.createShorthand = createShorthand;
exports.createShorthandFactory = createShorthandFactory;
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
// ============================================================
// Factories
// ============================================================
/**
* A more robust React.createElement. It can create elements from primitive values.
*
* @param {function|string} Component A ReactClass or string
* @param {function} mapValueToProps A function that maps a primitive value to the Component props
* @param {string|object|function} val The value to create a ReactElement from
* @param {Object} [options={}]
* @param {object} [options.defaultProps={}] Default props object
* @param {object|function} [options.overrideProps={}] Override props object or function (called with regular props)
* @returns {object|null}
*/
function createShorthand(Component, mapValueToProps, val) {
var options = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : {};
if (typeof Component !== 'function' && typeof Component !== 'string') {
throw new Error('createShorthandFactory() Component must be a string or function.');
}
// short circuit noop values
if ((0, _isNil3.default)(val) || (0, _isBoolean3.default)(val)) return null;
var valIsString = (0, _isString3.default)(val);
var valIsNumber = (0, _isNumber3.default)(val);
var isReactElement = (0, _react.isValidElement)(val);
var isPropsObject = (0, _isPlainObject3.default)(val);
var isPrimitiveValue = valIsString || valIsNumber || (0, _isArray3.default)(val);
// unhandled type return null
/* eslint-disable no-console */
if (!isReactElement && !isPropsObject && !isPrimitiveValue) {
if (process.env.NODE_ENV !== 'production') {
console.error(['Shorthand value must be a string|number|array|object|ReactElement.', ' Use null|undefined|boolean for none', ' Received ' + (typeof val === 'undefined' ? 'undefined' : (0, _typeof3.default)(val)) + '.'].join(''));
}
return null;
}
/* eslint-enable no-console */
// ----------------------------------------
// Build up props
// ----------------------------------------
var _options$defaultProps = options.defaultProps,
defaultProps = _options$defaultProps === undefined ? {} : _options$defaultProps;
// User's props
var usersProps = isReactElement && val.props || isPropsObject && val || isPrimitiveValue && mapValueToProps(val);
// Override props
var _options$overrideProp = options.overrideProps,
overrideProps = _options$overrideProp === undefined ? {} : _options$overrideProp;
overrideProps = (0, _isFunction3.default)(overrideProps) ? overrideProps((0, _extends3.default)({}, defaultProps, usersProps)) : overrideProps;
// Merge props
/* eslint-disable react/prop-types */
var props = (0, _extends3.default)({}, defaultProps, usersProps, overrideProps);
// Merge className
if (defaultProps.className || overrideProps.className || usersProps.className) {
var mergedClassesNames = (0, _classnames2.default)(defaultProps.className, overrideProps.className, usersProps.className);
props.className = (0, _uniq3.default)(mergedClassesNames.split(' ')).join(' ');
}
// Merge style
if (defaultProps.style || overrideProps.style || usersProps.style) {
props.style = (0, _extends3.default)({}, defaultProps.style, usersProps.style, overrideProps.style);
}
// ----------------------------------------
// Get key
// ----------------------------------------
// Use key, childKey, or generate key
if (!props.key) {
var childKey = props.childKey;
if (childKey) {
// apply and consume the childKey
props.key = typeof childKey === 'function' ? childKey(props) : childKey;
delete props.childKey;
} else if (valIsString || valIsNumber) {
// use string/number shorthand values as the key
props.key = val;
}
}
/* eslint-enable react/prop-types */
// ----------------------------------------
// Create Element
// ----------------------------------------
// Clone ReactElements
if (isReactElement) return (0, _react.cloneElement)(val, props);
// Create ReactElements from built up props
if (isPrimitiveValue || isPropsObject) return _react2.default.createElement(Component, props);
}
// ============================================================
// Factory Creators
// ============================================================
/**
* Creates a `createShorthand` function that is waiting for a value and options.
*
* @param {function|string} Component A ReactClass or string
* @param {function} mapValueToProps A function that maps a primitive value to the Component props
* @returns {function} A shorthand factory function waiting for `val` and `defaultProps`.
*/
createShorthand.handledProps = [];
function createShorthandFactory(Component, mapValueToProps) {
Iif (typeof Component !== 'function' && typeof Component !== 'string') {
throw new Error('createShorthandFactory() Component must be a string or function.');
}
return function (val, options) {
return createShorthand(Component, mapValueToProps, val, options);
};
}
// ============================================================
// HTML Factories
// ============================================================
var createHTMLDivision = exports.createHTMLDivision = createShorthandFactory('div', function (val) {
return { children: val };
});
var createHTMLImage = exports.createHTMLImage = createShorthandFactory('img', function (val) {
return { src: val };
});
var createHTMLInput = exports.createHTMLInput = createShorthandFactory('input', function (val) {
return { type: val };
});
var createHTMLLabel = exports.createHTMLLabel = createShorthandFactory('label', function (val) {
return { children: val };
});
var createHTMLParagraph = exports.createHTMLParagraph = createShorthandFactory('p', function (val) {
return { children: val };
});
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 | 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
/**
* Returns a createElement() type based on the props of the Component.
* Useful for calculating what type a component should render as.
*
* @param {function} Component A function or ReactClass.
* @param {object} props A ReactElement props object
* @param {function} [getDefault] A function that returns a default element type.
* @returns {string|function} A ReactElement type
*/
function getElementType(Component, props, getDefault) {
var _Component$defaultPro = Component.defaultProps,
defaultProps = _Component$defaultPro === undefined ? {} : _Component$defaultPro;
// ----------------------------------------
// user defined "as" element type
if (props.as && props.as !== defaultProps.as) return props.as;
// ----------------------------------------
// computed default element type
if (getDefault) {
var computedDefault = getDefault();
if (computedDefault) return computedDefault;
}
// ----------------------------------------
// infer anchor links
if (props.href) return 'a';
// ----------------------------------------
// use defaultProp or 'div'
return defaultProps.as || 'div';
}
exports.default = getElementType;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 | 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
/**
* Returns an object consisting of props beyond the scope of the Component.
* Useful for getting and spreading unknown props from the user.
* @param {function} Component A function or ReactClass.
* @param {object} props A ReactElement props object
* @returns {{}} A shallow copy of the prop object
*/
var getUnhandledProps = function getUnhandledProps(Component, props) {
// Note that `handledProps` are generated automatically during build with `babel-plugin-transform-react-handled-props`
var _Component$handledPro = Component.handledProps,
handledProps = _Component$handledPro === undefined ? [] : _Component$handledPro;
return Object.keys(props).reduce(function (acc, prop) {
if (prop === 'childKey') return acc;
if (handledProps.indexOf(prop) === -1) acc[prop] = props[prop];
return acc;
}, {});
};
exports.default = getUnhandledProps;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 | 1 1 1 1 1 1 2 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.partitionHTMLInputProps = exports.htmlInputProps = exports.htmlInputEvents = exports.htmlInputAttrs = undefined;
var _includes2 = require('lodash/includes');
var _includes3 = _interopRequireDefault(_includes2);
var _forEach2 = require('lodash/forEach');
var _forEach3 = _interopRequireDefault(_forEach2);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var htmlInputAttrs = exports.htmlInputAttrs = [
// REACT
'selected', 'defaultValue', 'defaultChecked',
// LIMITED HTML PROPS
'autoCapitalize', 'autoComplete', 'autoCorrect', 'autoFocus', 'checked', 'form', 'max', 'maxLength', 'min', 'multiple', 'name', 'pattern', 'placeholder', 'readOnly', 'required', 'step', 'type', 'value'];
var htmlInputEvents = exports.htmlInputEvents = [
// EVENTS
// keyboard
'onKeyDown', 'onKeyPress', 'onKeyUp',
// focus
'onFocus', 'onBlur',
// form
'onChange', 'onInput',
// mouse
'onClick', 'onContextMenu', 'onDrag', 'onDragEnd', 'onDragEnter', 'onDragExit', 'onDragLeave', 'onDragOver', 'onDragStart', 'onDrop', 'onMouseDown', 'onMouseEnter', 'onMouseLeave', 'onMouseMove', 'onMouseOut', 'onMouseOver', 'onMouseUp',
// selection
'onSelect',
// touch
'onTouchCancel', 'onTouchEnd', 'onTouchMove', 'onTouchStart'];
var htmlInputProps = exports.htmlInputProps = [].concat(htmlInputAttrs, htmlInputEvents);
/**
* Returns an array of objects consisting of: props of html input element and rest.
* @param {object} props A ReactElement props object
* @param {array} [htmlProps] An array of html input props
* @returns {[{}, {}]} An array of objects
*/
var partitionHTMLInputProps = exports.partitionHTMLInputProps = function partitionHTMLInputProps(props) {
var htmlProps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : htmlInputProps;
var inputProps = {};
var rest = {};
(0, _forEach3.default)(props, function (val, prop) {
return (0, _includes3.default)(htmlProps, prop) ? inputProps[prop] = val : rest[prop] = val;
});
return [inputProps, rest];
};
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 | 1 1 1 1 10 1 1 1 1 1 1 1 1 1 1 1 7 1 1 7 7 33 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 4 10 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.objectDiff = exports.numberToWord = exports.numberToWordMap = exports.keyboardKey = exports.SUI = exports.META = exports.leven = exports.isBrowser = exports.partitionHTMLInputProps = exports.htmlInputProps = exports.htmlInputEvents = exports.htmlInputAttrs = exports.getElementType = exports.getUnhandledProps = exports.makeDebugger = exports.debug = exports.customPropTypes = exports.useWidthProp = exports.useVerticalAlignProp = exports.useTextAlignProp = exports.useOnlyProp = exports.useValueAndKey = exports.useKeyOrValueAndKey = exports.useKeyOnly = exports.childrenUtils = exports.AutoControlledComponent = undefined;
var _AutoControlledComponent = require('./AutoControlledComponent');
Object.defineProperty(exports, 'AutoControlledComponent', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_AutoControlledComponent).default;
}
});
var _classNameBuilders = require('./classNameBuilders');
Object.defineProperty(exports, 'useKeyOnly', {
enumerable: true,
get: function get() {
return _classNameBuilders.useKeyOnly;
}
});
Object.defineProperty(exports, 'useKeyOrValueAndKey', {
enumerable: true,
get: function get() {
return _classNameBuilders.useKeyOrValueAndKey;
}
});
Object.defineProperty(exports, 'useValueAndKey', {
enumerable: true,
get: function get() {
return _classNameBuilders.useValueAndKey;
}
});
Object.defineProperty(exports, 'useOnlyProp', {
enumerable: true,
get: function get() {
return _classNameBuilders.useOnlyProp;
}
});
Object.defineProperty(exports, 'useTextAlignProp', {
enumerable: true,
get: function get() {
return _classNameBuilders.useTextAlignProp;
}
});
Object.defineProperty(exports, 'useVerticalAlignProp', {
enumerable: true,
get: function get() {
return _classNameBuilders.useVerticalAlignProp;
}
});
Object.defineProperty(exports, 'useWidthProp', {
enumerable: true,
get: function get() {
return _classNameBuilders.useWidthProp;
}
});
var _debug = require('./debug');
Object.defineProperty(exports, 'debug', {
enumerable: true,
get: function get() {
return _debug.debug;
}
});
Object.defineProperty(exports, 'makeDebugger', {
enumerable: true,
get: function get() {
return _debug.makeDebugger;
}
});
var _factories = require('./factories');
Object.keys(_factories).forEach(function (key) {
Iif (key === "default" || key === "__esModule") return;
Object.defineProperty(exports, key, {
enumerable: true,
get: function get() {
return _factories[key];
}
});
});
var _getUnhandledProps = require('./getUnhandledProps');
Object.defineProperty(exports, 'getUnhandledProps', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_getUnhandledProps).default;
}
});
var _getElementType = require('./getElementType');
Object.defineProperty(exports, 'getElementType', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_getElementType).default;
}
});
var _htmlInputPropsUtils = require('./htmlInputPropsUtils');
Object.defineProperty(exports, 'htmlInputAttrs', {
enumerable: true,
get: function get() {
return _htmlInputPropsUtils.htmlInputAttrs;
}
});
Object.defineProperty(exports, 'htmlInputEvents', {
enumerable: true,
get: function get() {
return _htmlInputPropsUtils.htmlInputEvents;
}
});
Object.defineProperty(exports, 'htmlInputProps', {
enumerable: true,
get: function get() {
return _htmlInputPropsUtils.htmlInputProps;
}
});
Object.defineProperty(exports, 'partitionHTMLInputProps', {
enumerable: true,
get: function get() {
return _htmlInputPropsUtils.partitionHTMLInputProps;
}
});
var _isBrowser = require('./isBrowser');
Object.defineProperty(exports, 'isBrowser', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_isBrowser).default;
}
});
var _leven = require('./leven');
Object.defineProperty(exports, 'leven', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_leven).default;
}
});
var _keyboardKey = require('./keyboardKey');
Object.defineProperty(exports, 'keyboardKey', {
enumerable: true,
get: function get() {
return _interopRequireDefault(_keyboardKey).default;
}
});
var _numberToWord = require('./numberToWord');
Object.defineProperty(exports, 'numberToWordMap', {
enumerable: true,
get: function get() {
return _numberToWord.numberToWordMap;
}
});
Object.defineProperty(exports, 'numberToWord', {
enumerable: true,
get: function get() {
return _numberToWord.numberToWord;
}
});
var _objectDiff = require('./objectDiff');
Object.defineProperty(exports, 'objectDiff', {
enumerable: true,
get: function get() {
return _objectDiff.objectDiff;
}
});
var _childrenUtils2 = require('./childrenUtils');
var _childrenUtils = _interopRequireWildcard(_childrenUtils2);
var _customPropTypes2 = require('./customPropTypes');
var _customPropTypes = _interopRequireWildcard(_customPropTypes2);
var _META2 = require('./META');
var _META = _interopRequireWildcard(_META2);
var _SUI2 = require('./SUI');
var _SUI = _interopRequireWildcard(_SUI2);
function _interopRequireWildcard(obj) { Eif (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) newObj[key] = obj[key]; } } newObj.default = obj; return newObj; } }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.childrenUtils = _childrenUtils;
exports.customPropTypes = _customPropTypes;
exports.META = _META;
exports.SUI = _SUI;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 | 1 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _typeof2 = require('babel-runtime/helpers/typeof');
var _typeof3 = _interopRequireDefault(_typeof2);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var hasDocument = (typeof document === 'undefined' ? 'undefined' : (0, _typeof3.default)(document)) === 'object' && document !== null;
var hasWindow = (typeof window === 'undefined' ? 'undefined' : (0, _typeof3.default)(window)) === 'object' && window !== null && window.self === window;
exports.default = hasDocument && hasWindow;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 | 1 1 1 1 1 2 1 1 24 1 26 26 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _isObject2 = require('lodash/isObject');
var _isObject3 = _interopRequireDefault(_isObject2);
var _times2 = require('lodash/times');
var _times3 = _interopRequireDefault(_times2);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* All previous KeyboardEvent key identifying properties are deprecated in favor of `key`.
* Unfortunately, `key` is not yet fully supported.
* @see https://developer.mozilla.org/en-US/docs/Web/API/KeyboardEvent/key
*/
var codes = {
// ----------------------------------------
// By Code
// ----------------------------------------
3: 'Cancel',
6: 'Help',
8: 'Backspace',
9: 'Tab',
12: 'Clear',
13: 'Enter',
16: 'Shift',
17: 'Control',
18: 'Alt',
19: 'Pause',
20: 'CapsLock',
27: 'Escape',
28: 'Convert',
29: 'NonConvert',
30: 'Accept',
31: 'ModeChange',
32: ' ',
33: 'PageUp',
34: 'PageDown',
35: 'End',
36: 'Home',
37: 'ArrowLeft',
38: 'ArrowUp',
39: 'ArrowRight',
40: 'ArrowDown',
41: 'Select',
42: 'Print',
43: 'Execute',
44: 'PrintScreen',
45: 'Insert',
46: 'Delete',
48: ['0', ')'],
49: ['1', '!'],
50: ['2', '@'],
51: ['3', '#'],
52: ['4', '$'],
53: ['5', '%'],
54: ['6', '^'],
55: ['7', '&'],
56: ['8', '*'],
57: ['9', '('],
91: 'OS',
93: 'ContextMenu',
144: 'NumLock',
145: 'ScrollLock',
181: 'VolumeMute',
182: 'VolumeDown',
183: 'VolumeUp',
186: [';', ':'],
187: ['=', '+'],
188: [',', '<'],
189: ['-', '_'],
190: ['.', '>'],
191: ['/', '?'],
192: ['`', '~'],
219: ['[', '{'],
220: ['\\', '|'],
221: [']', '}'],
222: ["'", '"'],
224: 'Meta',
225: 'AltGraph',
246: 'Attn',
247: 'CrSel',
248: 'ExSel',
249: 'EraseEof',
250: 'Play',
251: 'ZoomOut'
};
// Function Keys (F1-24)
(0, _times3.default)(24, function (i) {
return codes[112 + i] = 'F' + (i + 1);
});
// Alphabet (a-Z)
(0, _times3.default)(26, function (i) {
var n = i + 65;
codes[n] = [String.fromCharCode(n + 32), String.fromCharCode(n)];
});
var keyboardKey = {
codes: codes,
/**
* Get the `keyCode` or `which` value from a keyboard event or `key` name.
* @param {string|object} name A keyboard event like object or `key` name.
* @param {string} [name.key] If object, it must have one of these keys.
* @param {string} [name.keyCode] If object, it must have one of these keys.
* @param {string} [name.which] If object, it must have one of these keys.
* @returns {*}
*/
getCode: function getCode(name) {
if ((0, _isObject3.default)(name)) {
return name.keyCode || name.which || this[name.key];
}
return this[name];
},
/**
* Get the key name from a keyboard event, `keyCode`, or `which` value.
* @param {number|object} code A keyboard event like object or key name.
* @param {number} [code.keyCode] If object, it must have one of these keys.
* @param {number} [code.which] If object, it must have one of these keys.
* @param {number} [code.shiftKey] If object, it must have one of these keys.
* @returns {*}
*/
getName: function getName(code) {
var isEvent = (0, _isObject3.default)(code);
var name = codes[isEvent ? code.keyCode || code.which : code];
if (Array.isArray(name)) {
if (isEvent) {
name = name[code.shiftKey ? 1 : 0];
} else {
name = name[0];
}
}
return name;
},
// ----------------------------------------
// By Name
// ----------------------------------------
// declare these manually for static analysis
Cancel: 3,
Help: 6,
Backspace: 8,
Tab: 9,
Clear: 12,
Enter: 13,
Shift: 16,
Control: 17,
Alt: 18,
Pause: 19,
CapsLock: 20,
Escape: 27,
Convert: 28,
NonConvert: 29,
Accept: 30,
ModeChange: 31,
' ': 32,
PageUp: 33,
PageDown: 34,
End: 35,
Home: 36,
ArrowLeft: 37,
ArrowUp: 38,
ArrowRight: 39,
ArrowDown: 40,
Select: 41,
Print: 42,
Execute: 43,
PrintScreen: 44,
Insert: 45,
Delete: 46,
0: 48, ')': 48,
1: 49, '!': 49,
2: 50, '@': 50,
3: 51, '#': 51,
4: 52, $: 52,
5: 53, '%': 53,
6: 54, '^': 54,
7: 55, '&': 55,
8: 56, '*': 56,
9: 57, '(': 57,
a: 65, A: 65,
b: 66, B: 66,
c: 67, C: 67,
d: 68, D: 68,
e: 69, E: 69,
f: 70, F: 70,
g: 71, G: 71,
h: 72, H: 72,
i: 73, I: 73,
j: 74, J: 74,
k: 75, K: 75,
l: 76, L: 76,
m: 77, M: 77,
n: 78, N: 78,
o: 79, O: 79,
p: 80, P: 80,
q: 81, Q: 81,
r: 82, R: 82,
s: 83, S: 83,
t: 84, T: 84,
u: 85, U: 85,
v: 86, V: 86,
w: 87, W: 87,
x: 88, X: 88,
y: 89, Y: 89,
z: 90, Z: 90,
OS: 91,
ContextMenu: 93,
F1: 112,
F2: 113,
F3: 114,
F4: 115,
F5: 116,
F6: 117,
F7: 118,
F8: 119,
F9: 120,
F10: 121,
F11: 122,
F12: 123,
F13: 124,
F14: 125,
F15: 126,
F16: 127,
F17: 128,
F18: 129,
F19: 130,
F20: 131,
F21: 132,
F22: 133,
F23: 134,
F24: 135,
NumLock: 144,
ScrollLock: 145,
VolumeMute: 181,
VolumeDown: 182,
VolumeUp: 183,
';': 186, ':': 186,
'=': 187, '+': 187,
',': 188, '<': 188,
'-': 189, _: 189,
'.': 190, '>': 190,
'/': 191, '?': 191,
'`': 192, '~': 192,
'[': 219, '{': 219,
'\\': 220, '\|': 220,
']': 221, '}': 221,
"'": 222, '"': 222,
Meta: 224,
AltGraph: 225,
Attn: 246,
CrSel: 247,
ExSel: 248,
EraseEof: 249,
Play: 250,
ZoomOut: 251
};
// ----------------------------------------
// By Alias
// ----------------------------------------
// provide dot-notation accessible keys for all key names
keyboardKey.Spacebar = keyboardKey[' '];
keyboardKey.Digit0 = keyboardKey['0'];
keyboardKey.Digit1 = keyboardKey['1'];
keyboardKey.Digit2 = keyboardKey['2'];
keyboardKey.Digit3 = keyboardKey['3'];
keyboardKey.Digit4 = keyboardKey['4'];
keyboardKey.Digit5 = keyboardKey['5'];
keyboardKey.Digit6 = keyboardKey['6'];
keyboardKey.Digit7 = keyboardKey['7'];
keyboardKey.Digit8 = keyboardKey['8'];
keyboardKey.Digit9 = keyboardKey['9'];
keyboardKey.Tilde = keyboardKey['~'];
keyboardKey.GraveAccent = keyboardKey['`'];
keyboardKey.ExclamationPoint = keyboardKey['!'];
keyboardKey.AtSign = keyboardKey['@'];
keyboardKey.PoundSign = keyboardKey['#'];
keyboardKey.PercentSign = keyboardKey['%'];
keyboardKey.Caret = keyboardKey['^'];
keyboardKey.Ampersand = keyboardKey['&'];
keyboardKey.PlusSign = keyboardKey['+'];
keyboardKey.MinusSign = keyboardKey['-'];
keyboardKey.EqualsSign = keyboardKey['='];
keyboardKey.DivisionSign = keyboardKey['/'];
keyboardKey.MultiplicationSign = keyboardKey['*'];
keyboardKey.Comma = keyboardKey[','];
keyboardKey.Decimal = keyboardKey['.'];
keyboardKey.Colon = keyboardKey[':'];
keyboardKey.Semicolon = keyboardKey[';'];
keyboardKey.Pipe = keyboardKey['|'];
keyboardKey.BackSlash = keyboardKey['\\'];
keyboardKey.QuestionMark = keyboardKey['?'];
keyboardKey.SingleQuote = keyboardKey['"'];
keyboardKey.DoubleQuote = keyboardKey['"'];
keyboardKey.LeftCurlyBrace = keyboardKey['{'];
keyboardKey.RightCurlyBrace = keyboardKey['}'];
keyboardKey.LeftParenthesis = keyboardKey['('];
keyboardKey.RightParenthesis = keyboardKey[')'];
keyboardKey.LeftAngleBracket = keyboardKey['<'];
keyboardKey.RightAngleBracket = keyboardKey['>'];
keyboardKey.LeftSquareBracket = keyboardKey['['];
keyboardKey.RightSquareBracket = keyboardKey[']'];
exports.default = keyboardKey;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | 1 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
// Copy of sindre's leven, wrapped in dead code elimination for production
// https://github.com/sindresorhus/leven/blob/master/index.js
var leven = function leven() {
return 0;
};
Eif (process.env.NODE_ENV !== 'production') {
/* eslint-disable complexity, no-nested-ternary */
var arr = [];
var charCodeCache = [];
leven = function leven(a, b) {
if (a === b) return 0;
var aLen = a.length;
var bLen = b.length;
if (aLen === 0) return bLen;
if (bLen === 0) return aLen;
var bCharCode = void 0;
var ret = void 0;
var tmp = void 0;
var tmp2 = void 0;
var i = 0;
var j = 0;
while (i < aLen) {
charCodeCache[i] = a.charCodeAt(i);
arr[i] = ++i;
}
while (j < bLen) {
bCharCode = b.charCodeAt(j);
tmp = j++;
ret = j;
for (i = 0; i < aLen; i++) {
tmp2 = bCharCode === charCodeCache[i] ? tmp : tmp + 1;
tmp = arr[i];
ret = arr[i] = tmp > ret ? tmp2 > ret ? ret + 1 : tmp2 : tmp2 > tmp ? tmp + 1 : tmp2;
}
}
return ret;
};
}
exports.default = leven;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 | 1 1 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.numberToWordMap = undefined;
var _typeof2 = require('babel-runtime/helpers/typeof');
var _typeof3 = _interopRequireDefault(_typeof2);
exports.numberToWord = numberToWord;
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var numberToWordMap = exports.numberToWordMap = {
1: 'one',
2: 'two',
3: 'three',
4: 'four',
5: 'five',
6: 'six',
7: 'seven',
8: 'eight',
9: 'nine',
10: 'ten',
11: 'eleven',
12: 'twelve',
13: 'thirteen',
14: 'fourteen',
15: 'fifteen',
16: 'sixteen'
};
/**
* Return the number word for numbers 1-16.
* Returns strings or numbers as is if there is no corresponding word.
* Returns an empty string if value is not a string or number.
* @param {string|number} value The value to convert to a word.
* @returns {string}
*/
function numberToWord(value) {
var type = typeof value === 'undefined' ? 'undefined' : (0, _typeof3.default)(value);
if (type === 'string' || type === 'number') {
return numberToWordMap[value] || value;
}
return '';
}
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 | 1 1 1 1 1 1 1 1 3 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.objectDiff = undefined;
var _isEqual2 = require('lodash/isEqual');
var _isEqual3 = _interopRequireDefault(_isEqual2);
var _has2 = require('lodash/has');
var _has3 = _interopRequireDefault(_has2);
var _transform2 = require('lodash/transform');
var _transform3 = _interopRequireDefault(_transform2);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* Naive and inefficient object difference, intended for development / debugging use only.
* Deleted keys are shown as [DELETED].
* @param {{}} source The source object
* @param {{}} target The target object.
* @returns {{}} A new object containing new/modified/deleted keys.
* @example
* import { objectDiff } from 'src/lib'
*
* const a = { key: 'val', foo: 'bar' }
* const b = { key: 'val', foo: 'baz' }
*
* objectDiff(a, b)
* //=> { foo: 'baz' }
*/
var objectDiff = exports.objectDiff = function objectDiff(source, target) {
return (0, _transform3.default)(source, function (res, val, key) {
// deleted keys
if (!(0, _has3.default)(target, key)) res[key] = '[DELETED]';
// new keys / changed values
else if (!(0, _isEqual3.default)(val, target[key])) res[key] = target[key];
}, {});
};
|
| File | Statements | Branches | Functions | Lines | |||||
|---|---|---|---|---|---|---|---|---|---|
| Accordion.js | 46.49% | (53 / 114) | 11.9% | (5 / 42) | 16.67% | (2 / 12) | 47.27% | (52 / 110) | |
| AccordionContent.js | 76.92% | (20 / 26) | 62.5% | (5 / 8) | 33.33% | (1 / 3) | 76% | (19 / 25) | |
| AccordionTitle.js | 66.67% | (34 / 51) | 41.67% | (5 / 12) | 33.33% | (2 / 6) | 67.35% | (33 / 49) |
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 | 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 18 1 1 1 1 1 1 1 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _toConsumableArray2 = require('babel-runtime/helpers/toConsumableArray');
var _toConsumableArray3 = _interopRequireDefault(_toConsumableArray2);
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
var _createClass2 = require('babel-runtime/helpers/createClass');
var _createClass3 = _interopRequireDefault(_createClass2);
var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
var _inherits2 = require('babel-runtime/helpers/inherits');
var _inherits3 = _interopRequireDefault(_inherits2);
var _keys2 = require('lodash/keys');
var _keys3 = _interopRequireDefault(_keys2);
var _omit2 = require('lodash/omit');
var _omit3 = _interopRequireDefault(_omit2);
var _isFunction2 = require('lodash/isFunction');
var _isFunction3 = _interopRequireDefault(_isFunction2);
var _each2 = require('lodash/each');
var _each3 = _interopRequireDefault(_each2);
var _has2 = require('lodash/has');
var _has3 = _interopRequireDefault(_has2);
var _without2 = require('lodash/without');
var _without3 = _interopRequireDefault(_without2);
var _includes2 = require('lodash/includes');
var _includes3 = _interopRequireDefault(_includes2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
var _AccordionContent = require('./AccordionContent');
var _AccordionContent2 = _interopRequireDefault(_AccordionContent);
var _AccordionTitle = require('./AccordionTitle');
var _AccordionTitle2 = _interopRequireDefault(_AccordionTitle);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* An accordion allows users to toggle the display of sections of content.
*/
var Accordion = function (_Component) {
(0, _inherits3.default)(Accordion, _Component);
function Accordion() {
var _ref;
(0, _classCallCheck3.default)(this, Accordion);
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
var _this = (0, _possibleConstructorReturn3.default)(this, (_ref = Accordion.__proto__ || Object.getPrototypeOf(Accordion)).call.apply(_ref, [this].concat(args)));
_this.state = {};
_this.handleTitleClick = function (e, index) {
var _this$props = _this.props,
onTitleClick = _this$props.onTitleClick,
exclusive = _this$props.exclusive;
var activeIndex = _this.state.activeIndex;
var newIndex = void 0;
if (exclusive) {
newIndex = index === activeIndex ? -1 : index;
} else {
// check to see if index is in array, and remove it, if not then add it
newIndex = (0, _includes3.default)(activeIndex, index) ? (0, _without3.default)(activeIndex, index) : [].concat((0, _toConsumableArray3.default)(activeIndex), [index]);
}
_this.trySetState({ activeIndex: newIndex });
if (onTitleClick) onTitleClick(e, index);
};
_this.isIndexActive = function (index) {
var exclusive = _this.props.exclusive;
var activeIndex = _this.state.activeIndex;
return exclusive ? activeIndex === index : (0, _includes3.default)(activeIndex, index);
};
_this.renderChildren = function () {
var children = _this.props.children;
var titleIndex = 0;
var contentIndex = 0;
return _react.Children.map(children, function (child) {
var isTitle = child.type === _AccordionTitle2.default;
var isContent = child.type === _AccordionContent2.default;
if (isTitle) {
var currentIndex = titleIndex;
var isActive = (0, _has3.default)(child, 'props.active') ? child.props.active : _this.isIndexActive(titleIndex);
var onClick = function onClick(e) {
_this.handleTitleClick(e, currentIndex);
if (child.props.onClick) child.props.onClick(e, currentIndex);
};
titleIndex++;
return (0, _react.cloneElement)(child, (0, _extends3.default)({}, child.props, { active: isActive, onClick: onClick }));
}
if (isContent) {
var _isActive = (0, _has3.default)(child, 'props.active') ? child.props.active : _this.isIndexActive(contentIndex);
contentIndex++;
return (0, _react.cloneElement)(child, (0, _extends3.default)({}, child.props, { active: _isActive }));
}
return child;
});
};
_this.renderPanels = function () {
var panels = _this.props.panels;
var children = [];
(0, _each3.default)(panels, function (panel, i) {
var isActive = (0, _has3.default)(panel, 'active') ? panel.active : _this.isIndexActive(i);
var onClick = function onClick(e) {
_this.handleTitleClick(e, i);
if (panel.onClick) panel.onClick(e, i);
};
// implement all methods of creating a key that are supported in factories
var key = panel.key || (0, _isFunction3.default)(panel.childKey) && panel.childKey(panel) || panel.childKey && panel.childKey || panel.title;
children.push(_AccordionTitle2.default.create({ active: isActive, onClick: onClick, key: key + '-title', content: panel.title }));
children.push(_AccordionContent2.default.create({ active: isActive, key: key + '-content', content: panel.content }));
});
return children;
};
_this.state = {
activeIndex: _this.props.exclusive ? -1 : [-1]
};
return _this;
}
(0, _createClass3.default)(Accordion, [{
key: 'render',
value: function render() {
var _props = this.props,
className = _props.className,
fluid = _props.fluid,
inverted = _props.inverted,
panels = _props.panels,
styled = _props.styled;
var classes = (0, _classnames2.default)('ui', (0, _lib.useKeyOnly)(fluid, 'fluid'), (0, _lib.useKeyOnly)(inverted, 'inverted'), (0, _lib.useKeyOnly)(styled, 'styled'), 'accordion', className);
var rest = (0, _omit3.default)(this.props, (0, _keys3.default)(Accordion.propTypes));
var ElementType = (0, _lib.getElementType)(Accordion, this.props);
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
panels ? this.renderPanels() : this.renderChildren()
);
}
}]);
return Accordion;
}(_lib.AutoControlledComponent);
Accordion.defaultProps = {
exclusive: true
};
Accordion.autoControlledProps = ['activeIndex'];
Accordion._meta = {
name: 'Accordion',
type: _lib.META.TYPES.MODULE
};
Accordion.Content = _AccordionContent2.default;
Accordion.Title = _AccordionTitle2.default;
exports.default = Accordion;
process.env.NODE_ENV !== "production" ? Accordion.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Index of the currently active panel. */
activeIndex: _propTypes2.default.oneOfType([_propTypes2.default.arrayOf(_propTypes2.default.number), _propTypes2.default.number]),
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string,
/** Initial activeIndex value. */
defaultActiveIndex: _propTypes2.default.oneOfType([_propTypes2.default.arrayOf(_propTypes2.default.number), _propTypes2.default.number]),
/** Only allow one panel open at a time. */
exclusive: _propTypes2.default.bool,
/** Format to take up the width of it's container. */
fluid: _propTypes2.default.bool,
/** Format for dark backgrounds. */
inverted: _propTypes2.default.bool,
/**
* Called when a panel title is clicked.
*
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {number} index - The index of the clicked panel.
*/
onTitleClick: _propTypes2.default.func,
/**
* Create simple accordion panels from an array of { text: <string>, content: <custom> } objects.
* Object can optionally define an `active` key to open/close the panel.
* Object can opitonally define a `key` key used for title and content nodes' keys.
* Mutually exclusive with children.
* TODO: AccordionPanel should be a sub-component
*/
panels: _lib.customPropTypes.every([_lib.customPropTypes.disallow(['children']), _propTypes2.default.arrayOf(_propTypes2.default.shape({
key: _propTypes2.default.string,
active: _propTypes2.default.bool,
title: _lib.customPropTypes.contentShorthand,
content: _lib.customPropTypes.contentShorthand,
onClick: _propTypes2.default.func
}))]),
/** Adds some basic styling to accordion panels. */
styled: _propTypes2.default.bool
} : void 0;
Accordion.handledProps = ['activeIndex', 'as', 'children', 'className', 'defaultActiveIndex', 'exclusive', 'fluid', 'inverted', 'onTitleClick', 'panels', 'styled'];
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 | 1 1 1 1 1 1 1 1 1 1 1 1 5 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _isNil2 = require('lodash/isNil');
var _isNil3 = _interopRequireDefault(_isNil2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* A content sub-component for Accordion component.
*/
function AccordionContent(props) {
var active = props.active,
children = props.children,
className = props.className,
content = props.content;
var classes = (0, _classnames2.default)('content', (0, _lib.useKeyOnly)(active, 'active'), className);
var rest = (0, _lib.getUnhandledProps)(AccordionContent, props);
var ElementType = (0, _lib.getElementType)(AccordionContent, props);
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
(0, _isNil3.default)(children) ? content : children
);
}
AccordionContent.handledProps = ['active', 'as', 'children', 'className', 'content'];
process.env.NODE_ENV !== "production" ? AccordionContent.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Whether or not the content is visible. */
active: _propTypes2.default.bool,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string,
/** Shorthand for primary content. */
content: _lib.customPropTypes.contentShorthand
} : void 0;
AccordionContent._meta = {
name: 'AccordionContent',
type: _lib.META.TYPES.MODULE,
parent: 'Accordion'
};
AccordionContent.create = (0, _lib.createShorthandFactory)(AccordionContent, function (content) {
return { content: content };
});
exports.default = AccordionContent;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 | 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 10 1 1 1 1 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
var _createClass2 = require('babel-runtime/helpers/createClass');
var _createClass3 = _interopRequireDefault(_createClass2);
var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
var _inherits2 = require('babel-runtime/helpers/inherits');
var _inherits3 = _interopRequireDefault(_inherits2);
var _isNil2 = require('lodash/isNil');
var _isNil3 = _interopRequireDefault(_isNil2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
var _Icon = require('../../elements/Icon');
var _Icon2 = _interopRequireDefault(_Icon);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* A title sub-component for Accordion component.
*/
var AccordionTitle = function (_Component) {
(0, _inherits3.default)(AccordionTitle, _Component);
function AccordionTitle() {
var _ref;
var _temp, _this, _ret;
(0, _classCallCheck3.default)(this, AccordionTitle);
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return _ret = (_temp = (_this = (0, _possibleConstructorReturn3.default)(this, (_ref = AccordionTitle.__proto__ || Object.getPrototypeOf(AccordionTitle)).call.apply(_ref, [this].concat(args))), _this), _this.handleClick = function (e) {
var onClick = _this.props.onClick;
if (onClick) onClick(e, _this.props);
}, _temp), (0, _possibleConstructorReturn3.default)(_this, _ret);
}
(0, _createClass3.default)(AccordionTitle, [{
key: 'render',
value: function render() {
var _props = this.props,
active = _props.active,
children = _props.children,
className = _props.className,
content = _props.content;
var classes = (0, _classnames2.default)((0, _lib.useKeyOnly)(active, 'active'), 'title', className);
var rest = (0, _lib.getUnhandledProps)(AccordionTitle, this.props);
var ElementType = (0, _lib.getElementType)(AccordionTitle, this.props);
if ((0, _isNil3.default)(content)) {
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes, onClick: this.handleClick }),
children
);
}
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes, onClick: this.handleClick }),
_react2.default.createElement(_Icon2.default, { name: 'dropdown' }),
content
);
}
}]);
return AccordionTitle;
}(_react.Component);
AccordionTitle._meta = {
name: 'AccordionTitle',
type: _lib.META.TYPES.MODULE,
parent: 'Accordion'
};
exports.default = AccordionTitle;
process.env.NODE_ENV !== "production" ? AccordionTitle.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Whether or not the title is in the open state. */
active: _propTypes2.default.bool,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string,
/** Shorthand for primary content. */
content: _lib.customPropTypes.contentShorthand,
/**
* Called on click.
*
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {object} data - All props.
*/
onClick: _propTypes2.default.func
} : void 0;
AccordionTitle.handledProps = ['active', 'as', 'children', 'className', 'content', 'onClick'];
AccordionTitle.create = (0, _lib.createShorthandFactory)(AccordionTitle, function (content) {
return { content: content };
});
|
| File | Statements | Branches | Functions | Lines | |||||
|---|---|---|---|---|---|---|---|---|---|
| Checkbox.js | 47.37% | (36 / 76) | 17.24% | (5 / 29) | 16.67% | (2 / 12) | 50% | (35 / 70) | |
| index.js | 100% | (7 / 7) | 75% | (3 / 4) | 100% | (1 / 1) | 100% | (6 / 6) |
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 | 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 10 1 1 1 1 1 1 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
var _createClass2 = require('babel-runtime/helpers/createClass');
var _createClass3 = _interopRequireDefault(_createClass2);
var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
var _inherits2 = require('babel-runtime/helpers/inherits');
var _inherits3 = _interopRequireDefault(_inherits2);
var _invoke2 = require('lodash/fp/invoke');
var _invoke3 = _interopRequireDefault(_invoke2);
var _isNil2 = require('lodash/fp/isNil');
var _isNil3 = _interopRequireDefault(_isNil2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var debug = (0, _lib.makeDebugger)('checkbox');
/**
* A checkbox allows a user to select a value from a small set of options, often binary.
* @see Form
* @see Radio
*/
var Checkbox = function (_Component) {
(0, _inherits3.default)(Checkbox, _Component);
function Checkbox() {
var _ref;
var _temp, _this, _ret;
(0, _classCallCheck3.default)(this, Checkbox);
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return _ret = (_temp = (_this = (0, _possibleConstructorReturn3.default)(this, (_ref = Checkbox.__proto__ || Object.getPrototypeOf(Checkbox)).call.apply(_ref, [this].concat(args))), _this), _this.state = {}, _this.canToggle = function () {
var _this$props = _this.props,
disabled = _this$props.disabled,
radio = _this$props.radio,
readOnly = _this$props.readOnly;
var checked = _this.state.checked;
return !disabled && !readOnly && !(radio && checked);
}, _this.computeTabIndex = function () {
var _this$props2 = _this.props,
disabled = _this$props2.disabled,
tabIndex = _this$props2.tabIndex;
if (!(0, _isNil3.default)(tabIndex)) return tabIndex;
return disabled ? -1 : 0;
}, _this.handleInputRef = function (c) {
return _this.inputRef = c;
}, _this.handleClick = function (e) {
debug('handleClick()');
var _this$props3 = _this.props,
onChange = _this$props3.onChange,
onClick = _this$props3.onClick;
var _this$state = _this.state,
checked = _this$state.checked,
indeterminate = _this$state.indeterminate;
if (_this.canToggle()) {
if (onClick) onClick(e, (0, _extends3.default)({}, _this.props, { checked: !!checked, indeterminate: !!indeterminate }));
if (onChange) onChange(e, (0, _extends3.default)({}, _this.props, { checked: !checked, indeterminate: false }));
_this.trySetState({ checked: !checked, indeterminate: false });
}
}, _this.handleMouseDown = function (e) {
debug('handleMouseDown()');
var onMouseDown = _this.props.onMouseDown;
var _this$state2 = _this.state,
checked = _this$state2.checked,
indeterminate = _this$state2.indeterminate;
(0, _invoke3.default)('focus', _this.inputRef);
if (onMouseDown) onMouseDown(e, (0, _extends3.default)({}, _this.props, { checked: !!checked, indeterminate: !!indeterminate }));
}, _this.setIndeterminate = function () {
var indeterminate = _this.state.indeterminate;
if (_this.inputRef) _this.inputRef.indeterminate = !!indeterminate;
}, _temp), (0, _possibleConstructorReturn3.default)(_this, _ret);
}
(0, _createClass3.default)(Checkbox, [{
key: 'componentDidMount',
value: function componentDidMount() {
this.setIndeterminate();
}
}, {
key: 'componentDidUpdate',
value: function componentDidUpdate() {
this.setIndeterminate();
}
// Note: You can't directly set the indeterminate prop on the input, so we
// need to maintain a ref to the input and set it manually whenever the
// component updates.
}, {
key: 'render',
value: function render() {
var _props = this.props,
className = _props.className,
disabled = _props.disabled,
label = _props.label,
name = _props.name,
radio = _props.radio,
readOnly = _props.readOnly,
slider = _props.slider,
toggle = _props.toggle,
type = _props.type,
value = _props.value;
var _state = this.state,
checked = _state.checked,
indeterminate = _state.indeterminate;
var classes = (0, _classnames2.default)('ui', (0, _lib.useKeyOnly)(checked, 'checked'), (0, _lib.useKeyOnly)(disabled, 'disabled'), (0, _lib.useKeyOnly)(indeterminate, 'indeterminate'),
// auto apply fitted class to compact white space when there is no label
// https://semantic-ui.com/modules/checkbox.html#fitted
(0, _lib.useKeyOnly)(!label, 'fitted'), (0, _lib.useKeyOnly)(radio, 'radio'), (0, _lib.useKeyOnly)(readOnly, 'read-only'), (0, _lib.useKeyOnly)(slider, 'slider'), (0, _lib.useKeyOnly)(toggle, 'toggle'), 'checkbox', className);
var rest = (0, _lib.getUnhandledProps)(Checkbox, this.props);
var ElementType = (0, _lib.getElementType)(Checkbox, this.props);
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, {
className: classes,
onChange: this.handleClick,
onClick: this.handleClick,
onMouseDown: this.handleMouseDown
}),
_react2.default.createElement('input', {
checked: checked,
className: 'hidden',
name: name,
readOnly: true,
ref: this.handleInputRef,
tabIndex: this.computeTabIndex(),
type: type,
value: value
}),
(0, _lib.createHTMLLabel)(label) || _react2.default.createElement('label', null)
);
}
}]);
return Checkbox;
}(_lib.AutoControlledComponent);
Checkbox.defaultProps = {
type: 'checkbox'
};
Checkbox.autoControlledProps = ['checked', 'indeterminate'];
Checkbox._meta = {
name: 'Checkbox',
type: _lib.META.TYPES.MODULE
};
exports.default = Checkbox;
process.env.NODE_ENV !== "production" ? Checkbox.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Whether or not checkbox is checked. */
checked: _propTypes2.default.bool,
/** Additional classes. */
className: _propTypes2.default.string,
/** The initial value of checked. */
defaultChecked: _propTypes2.default.bool,
/** Whether or not checkbox is indeterminate. */
defaultIndeterminate: _propTypes2.default.bool,
/** A checkbox can appear disabled and be unable to change states */
disabled: _propTypes2.default.bool,
/** Removes padding for a label. Auto applied when there is no label. */
fitted: _propTypes2.default.bool,
/** Whether or not checkbox is indeterminate. */
indeterminate: _propTypes2.default.bool,
/** The text of the associated label element. */
label: _lib.customPropTypes.itemShorthand,
/** The HTML input name. */
name: _propTypes2.default.string,
/**
* Called when the user attempts to change the checked state.
*
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {object} data - All props and proposed checked/indeterminate state.
*/
onChange: _propTypes2.default.func,
/**
* Called when the checkbox or label is clicked.
*
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {object} data - All props and current checked/indeterminate state.
*/
onClick: _propTypes2.default.func,
/**
* Called when the user presses down on the mouse.
*
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {object} data - All props and current checked/indeterminate state.
*/
onMouseDown: _propTypes2.default.func,
/** Format as a radio element. This means it is an exclusive option. */
radio: _lib.customPropTypes.every([_propTypes2.default.bool, _lib.customPropTypes.disallow(['slider', 'toggle'])]),
/** A checkbox can be read-only and unable to change states. */
readOnly: _propTypes2.default.bool,
/** Format to emphasize the current selection state. */
slider: _lib.customPropTypes.every([_propTypes2.default.bool, _lib.customPropTypes.disallow(['radio', 'toggle'])]),
/** Format to show an on or off choice. */
toggle: _lib.customPropTypes.every([_propTypes2.default.bool, _lib.customPropTypes.disallow(['radio', 'slider'])]),
/** HTML input type, either checkbox or radio. */
type: _propTypes2.default.oneOf(['checkbox', 'radio']),
/** The HTML input value. */
value: _propTypes2.default.string,
/** A checkbox can receive focus. */
tabIndex: _propTypes2.default.oneOfType([_propTypes2.default.number, _propTypes2.default.string])
} : void 0;
Checkbox.handledProps = ['as', 'checked', 'className', 'defaultChecked', 'defaultIndeterminate', 'disabled', 'fitted', 'indeterminate', 'label', 'name', 'onChange', 'onClick', 'onMouseDown', 'radio', 'readOnly', 'slider', 'tabIndex', 'toggle', 'type', 'value'];
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = undefined;
var _Checkbox = require('./Checkbox');
var _Checkbox2 = _interopRequireDefault(_Checkbox);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = _Checkbox2.default;
|
| File | Statements | Branches | Functions | Lines | |||||
|---|---|---|---|---|---|---|---|---|---|
| Dimmer.js | 56.92% | (37 / 65) | 18.52% | (5 / 27) | 22.22% | (2 / 9) | 61.02% | (36 / 59) | |
| DimmerDimmable.js | 77.27% | (17 / 22) | 83.33% | (5 / 6) | 50% | (1 / 2) | 76.19% | (16 / 21) | |
| index.js | 100% | (7 / 7) | 75% | (3 / 4) | 100% | (1 / 1) | 100% | (6 / 6) |
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 | 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 11 1 1 1 1 1 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
var _createClass2 = require('babel-runtime/helpers/createClass');
var _createClass3 = _interopRequireDefault(_createClass2);
var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
var _inherits2 = require('babel-runtime/helpers/inherits');
var _inherits3 = _interopRequireDefault(_inherits2);
var _isNil2 = require('lodash/isNil');
var _isNil3 = _interopRequireDefault(_isNil2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
var _Portal = require('../../addons/Portal');
var _Portal2 = _interopRequireDefault(_Portal);
var _DimmerDimmable = require('./DimmerDimmable');
var _DimmerDimmable2 = _interopRequireDefault(_DimmerDimmable);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* A dimmer hides distractions to focus attention on particular content.
*/
var Dimmer = function (_Component) {
(0, _inherits3.default)(Dimmer, _Component);
function Dimmer() {
var _ref;
var _temp, _this, _ret;
(0, _classCallCheck3.default)(this, Dimmer);
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return _ret = (_temp = (_this = (0, _possibleConstructorReturn3.default)(this, (_ref = Dimmer.__proto__ || Object.getPrototypeOf(Dimmer)).call.apply(_ref, [this].concat(args))), _this), _this.handlePortalMount = function () {
if (_lib.isBrowser) document.body.classList.add('dimmed', 'dimmable');
}, _this.handlePortalUnmount = function () {
if (_lib.isBrowser) document.body.classList.remove('dimmed', 'dimmable');
}, _this.handleClick = function (e) {
var _this$props = _this.props,
onClick = _this$props.onClick,
onClickOutside = _this$props.onClickOutside;
if (onClick) onClick(e, _this.props);
if (_this.centerRef && _this.centerRef !== e.target && _this.centerRef.contains(e.target)) return;
if (onClickOutside) onClickOutside(e, _this.props);
}, _this.handleCenterRef = function (c) {
return _this.centerRef = c;
}, _temp), (0, _possibleConstructorReturn3.default)(_this, _ret);
}
(0, _createClass3.default)(Dimmer, [{
key: 'render',
value: function render() {
var _props = this.props,
active = _props.active,
children = _props.children,
className = _props.className,
content = _props.content,
disabled = _props.disabled,
inverted = _props.inverted,
page = _props.page,
simple = _props.simple;
var classes = (0, _classnames2.default)('ui', (0, _lib.useKeyOnly)(active, 'active transition visible'), (0, _lib.useKeyOnly)(disabled, 'disabled'), (0, _lib.useKeyOnly)(inverted, 'inverted'), (0, _lib.useKeyOnly)(page, 'page'), (0, _lib.useKeyOnly)(simple, 'simple'), 'dimmer', className);
var rest = (0, _lib.getUnhandledProps)(Dimmer, this.props);
var ElementType = (0, _lib.getElementType)(Dimmer, this.props);
var childrenContent = (0, _isNil3.default)(children) ? content : children;
var dimmerElement = _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes, onClick: this.handleClick }),
childrenContent && _react2.default.createElement(
'div',
{ className: 'content' },
_react2.default.createElement(
'div',
{ className: 'center', ref: this.handleCenterRef },
childrenContent
)
)
);
if (page) {
return _react2.default.createElement(
_Portal2.default,
{
closeOnEscape: false,
closeOnDocumentClick: false,
onMount: this.handlePortalMount,
onUnmount: this.handlePortalUnmount,
open: active,
openOnTriggerClick: false
},
dimmerElement
);
}
return dimmerElement;
}
}]);
return Dimmer;
}(_react.Component);
Dimmer._meta = {
name: 'Dimmer',
type: _lib.META.TYPES.MODULE
};
Dimmer.Dimmable = _DimmerDimmable2.default;
exports.default = Dimmer;
process.env.NODE_ENV !== "production" ? Dimmer.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** An active dimmer will dim its parent container. */
active: _propTypes2.default.bool,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string,
/** Shorthand for primary content. */
content: _lib.customPropTypes.contentShorthand,
/** A disabled dimmer cannot be activated */
disabled: _propTypes2.default.bool,
/**
* Called on click.
*
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {object} data - All props.
*/
onClick: _propTypes2.default.func,
/**
* Handles click outside Dimmer's content, but inside Dimmer area.
*
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {object} data - All props.
*/
onClickOutside: _propTypes2.default.func,
/** A dimmer can be formatted to have its colors inverted. */
inverted: _propTypes2.default.bool,
/** A dimmer can be formatted to be fixed to the page. */
page: _propTypes2.default.bool,
/** A dimmer can be controlled with simple prop. */
simple: _propTypes2.default.bool
} : void 0;
Dimmer.handledProps = ['active', 'as', 'children', 'className', 'content', 'disabled', 'inverted', 'onClick', 'onClickOutside', 'page', 'simple'];
Dimmer.create = (0, _lib.createShorthandFactory)(Dimmer, function (value) {
return { content: value };
});
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | 1 1 1 1 1 1 1 1 1 1 4 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* A dimmable sub-component for Dimmer.
*/
function DimmerDimmable(props) {
var blurring = props.blurring,
className = props.className,
children = props.children,
dimmed = props.dimmed;
var classes = (0, _classnames2.default)((0, _lib.useKeyOnly)(blurring, 'blurring'), (0, _lib.useKeyOnly)(dimmed, 'dimmed'), 'dimmable', className);
var rest = (0, _lib.getUnhandledProps)(DimmerDimmable, props);
var ElementType = (0, _lib.getElementType)(DimmerDimmable, props);
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
children
);
}
DimmerDimmable.handledProps = ['as', 'blurring', 'children', 'className', 'dimmed'];
DimmerDimmable._meta = {
name: 'DimmerDimmable',
type: _lib.META.TYPES.MODULE,
parent: 'Dimmer'
};
process.env.NODE_ENV !== "production" ? DimmerDimmable.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** A dimmable element can blur its contents. */
blurring: _propTypes2.default.bool,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string,
/** Controls whether or not the dim is displayed. */
dimmed: _propTypes2.default.bool
} : void 0;
exports.default = DimmerDimmable;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = undefined;
var _Dimmer = require('./Dimmer');
var _Dimmer2 = _interopRequireDefault(_Dimmer);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = _Dimmer2.default;
|
| File | Statements | Branches | Functions | Lines | |||||
|---|---|---|---|---|---|---|---|---|---|
| Dropdown.js | 16.01% | (90 / 562) | 1.53% | (5 / 327) | 3.23% | (2 / 62) | 17.45% | (89 / 510) | |
| DropdownDivider.js | 77.27% | (17 / 22) | 83.33% | (5 / 6) | 50% | (1 / 2) | 76.19% | (16 / 21) | |
| DropdownHeader.js | 73.33% | (22 / 30) | 62.5% | (5 / 8) | 33.33% | (1 / 3) | 75% | (21 / 28) | |
| DropdownItem.js | 60% | (39 / 65) | 27.78% | (5 / 18) | 28.57% | (2 / 7) | 60.32% | (38 / 63) | |
| DropdownMenu.js | 77.27% | (17 / 22) | 83.33% | (5 / 6) | 50% | (1 / 2) | 76.19% | (16 / 21) | |
| index.js | 100% | (7 / 7) | 75% | (3 / 4) | 100% | (1 / 1) | 100% | (6 / 6) |
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 745 746 747 748 749 750 751 752 753 754 755 756 757 758 759 760 761 762 763 764 765 766 767 768 769 770 771 772 773 774 775 776 777 778 779 780 781 782 783 784 785 786 787 788 789 790 791 792 793 794 795 796 797 798 799 800 801 802 803 804 805 806 807 808 809 810 811 812 813 814 815 816 817 818 819 820 821 822 823 824 825 826 827 828 829 830 831 832 833 834 835 836 837 838 839 840 841 842 843 844 845 846 847 848 849 850 851 852 853 854 855 856 857 858 859 860 861 862 863 864 865 866 867 868 869 870 871 872 873 874 875 876 877 878 879 880 881 882 883 884 885 886 887 888 889 890 891 892 893 894 895 896 897 898 899 900 901 902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1011 1012 1013 1014 1015 1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 1226 1227 1228 1229 1230 1231 1232 1233 1234 1235 1236 1237 1238 1239 1240 1241 1242 1243 1244 1245 1246 1247 1248 1249 1250 1251 1252 1253 1254 1255 1256 1257 1258 1259 1260 1261 1262 1263 1264 1265 1266 1267 1268 1269 1270 1271 1272 1273 1274 1275 1276 1277 1278 1279 1280 1281 1282 1283 1284 1285 1286 1287 1288 1289 1290 1291 1292 1293 1294 1295 1296 1297 1298 1299 1300 1301 1302 1303 1304 1305 1306 1307 1308 1309 1310 1311 1312 1313 1314 1315 1316 1317 1318 1319 1320 1321 1322 1323 1324 1325 1326 1327 1328 1329 1330 1331 1332 1333 1334 1335 1336 1337 1338 1339 1340 1341 1342 1343 1344 1345 1346 1347 1348 1349 1350 1351 1352 1353 1354 1355 1356 1357 1358 1359 1360 1361 1362 1363 | 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 35 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
var _createClass2 = require('babel-runtime/helpers/createClass');
var _createClass3 = _interopRequireDefault(_createClass2);
var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
var _get3 = require('babel-runtime/helpers/get');
var _get4 = _interopRequireDefault(_get3);
var _inherits2 = require('babel-runtime/helpers/inherits');
var _inherits3 = _interopRequireDefault(_inherits2);
var _compact2 = require('lodash/compact');
var _compact3 = _interopRequireDefault(_compact2);
var _map2 = require('lodash/map');
var _map3 = _interopRequireDefault(_map2);
var _isNil2 = require('lodash/isNil');
var _isNil3 = _interopRequireDefault(_isNil2);
var _every2 = require('lodash/every');
var _every3 = _interopRequireDefault(_every2);
var _without2 = require('lodash/without');
var _without3 = _interopRequireDefault(_without2);
var _findIndex2 = require('lodash/findIndex');
var _findIndex3 = _interopRequireDefault(_findIndex2);
var _find2 = require('lodash/find');
var _find3 = _interopRequireDefault(_find2);
var _reduce2 = require('lodash/reduce');
var _reduce3 = _interopRequireDefault(_reduce2);
var _some2 = require('lodash/some');
var _some3 = _interopRequireDefault(_some2);
var _escapeRegExp2 = require('lodash/escapeRegExp');
var _escapeRegExp3 = _interopRequireDefault(_escapeRegExp2);
var _filter2 = require('lodash/filter');
var _filter3 = _interopRequireDefault(_filter2);
var _isFunction2 = require('lodash/isFunction');
var _isFunction3 = _interopRequireDefault(_isFunction2);
var _dropRight2 = require('lodash/dropRight');
var _dropRight3 = _interopRequireDefault(_dropRight2);
var _isEmpty2 = require('lodash/isEmpty');
var _isEmpty3 = _interopRequireDefault(_isEmpty2);
var _union2 = require('lodash/union');
var _union3 = _interopRequireDefault(_union2);
var _get5 = require('lodash/get');
var _get6 = _interopRequireDefault(_get5);
var _includes2 = require('lodash/includes');
var _includes3 = _interopRequireDefault(_includes2);
var _isUndefined2 = require('lodash/isUndefined');
var _isUndefined3 = _interopRequireDefault(_isUndefined2);
var _has2 = require('lodash/has');
var _has3 = _interopRequireDefault(_has2);
var _isEqual2 = require('lodash/isEqual');
var _isEqual3 = _interopRequireDefault(_isEqual2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
var _Icon = require('../../elements/Icon');
var _Icon2 = _interopRequireDefault(_Icon);
var _Label = require('../../elements/Label');
var _Label2 = _interopRequireDefault(_Label);
var _DropdownDivider = require('./DropdownDivider');
var _DropdownDivider2 = _interopRequireDefault(_DropdownDivider);
var _DropdownItem = require('./DropdownItem');
var _DropdownItem2 = _interopRequireDefault(_DropdownItem);
var _DropdownHeader = require('./DropdownHeader');
var _DropdownHeader2 = _interopRequireDefault(_DropdownHeader);
var _DropdownMenu = require('./DropdownMenu');
var _DropdownMenu2 = _interopRequireDefault(_DropdownMenu);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var debug = (0, _lib.makeDebugger)('dropdown');
/**
* A dropdown allows a user to select a value from a series of options.
* @see Form
* @see Select
* @see Menu
*/
var Dropdown = function (_Component) {
(0, _inherits3.default)(Dropdown, _Component);
function Dropdown() {
var _ref;
var _temp, _this, _ret;
(0, _classCallCheck3.default)(this, Dropdown);
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return _ret = (_temp = (_this = (0, _possibleConstructorReturn3.default)(this, (_ref = Dropdown.__proto__ || Object.getPrototypeOf(Dropdown)).call.apply(_ref, [this].concat(args))), _this), _this.handleChange = function (e, value) {
debug('handleChange()');
debug(value);
var onChange = _this.props.onChange;
if (onChange) onChange(e, (0, _extends3.default)({}, _this.props, { value: value }));
}, _this.closeOnChange = function (e) {
var _this$props = _this.props,
closeOnChange = _this$props.closeOnChange,
multiple = _this$props.multiple;
var shouldClose = (0, _isUndefined3.default)(closeOnChange) ? !multiple : closeOnChange;
if (shouldClose) _this.close(e);
}, _this.closeOnEscape = function (e) {
if (_lib.keyboardKey.getCode(e) !== _lib.keyboardKey.Escape) return;
e.preventDefault();
_this.close();
}, _this.moveSelectionOnKeyDown = function (e) {
debug('moveSelectionOnKeyDown()');
debug(_lib.keyboardKey.getName(e));
switch (_lib.keyboardKey.getCode(e)) {
case _lib.keyboardKey.ArrowDown:
e.preventDefault();
_this.moveSelectionBy(1);
break;
case _lib.keyboardKey.ArrowUp:
e.preventDefault();
_this.moveSelectionBy(-1);
break;
default:
break;
}
}, _this.openOnSpace = function (e) {
debug('openOnSpace()');
if (_lib.keyboardKey.getCode(e) !== _lib.keyboardKey.Spacebar) return;
if (_this.state.open) return;
e.preventDefault();
_this.open(e);
}, _this.openOnArrow = function (e) {
debug('openOnArrow()');
var code = _lib.keyboardKey.getCode(e);
if (!(0, _includes3.default)([_lib.keyboardKey.ArrowDown, _lib.keyboardKey.ArrowUp], code)) return;
if (_this.state.open) return;
e.preventDefault();
_this.open(e);
}, _this.makeSelectedItemActive = function (e) {
var open = _this.state.open;
var _this$props2 = _this.props,
multiple = _this$props2.multiple,
onAddItem = _this$props2.onAddItem;
var item = _this.getSelectedItem();
var value = (0, _get6.default)(item, 'value');
// prevent selecting null if there was no selected item value
// prevent selecting duplicate items when the dropdown is closed
if (!value || !open) return;
// notify the onAddItem prop if this is a new value
if (onAddItem && item['data-additional']) {
onAddItem(e, (0, _extends3.default)({}, _this.props, { value: value }));
}
// notify the onChange prop that the user is trying to change value
if (multiple) {
// state value may be undefined
var newValue = (0, _union3.default)(_this.state.value, [value]);
_this.setValue(newValue);
_this.handleChange(e, newValue);
} else {
_this.setValue(value);
_this.handleChange(e, value);
}
}, _this.selectItemOnEnter = function (e) {
debug('selectItemOnEnter()');
debug(_lib.keyboardKey.getName(e));
if (_lib.keyboardKey.getCode(e) !== _lib.keyboardKey.Enter) return;
e.preventDefault();
_this.makeSelectedItemActive(e);
_this.closeOnChange(e);
}, _this.removeItemOnBackspace = function (e) {
debug('removeItemOnBackspace()');
debug(_lib.keyboardKey.getName(e));
if (_lib.keyboardKey.getCode(e) !== _lib.keyboardKey.Backspace) return;
var _this$props3 = _this.props,
multiple = _this$props3.multiple,
search = _this$props3.search;
var _this$state = _this.state,
searchQuery = _this$state.searchQuery,
value = _this$state.value;
if (searchQuery || !search || !multiple || (0, _isEmpty3.default)(value)) return;
e.preventDefault();
// remove most recent value
var newValue = (0, _dropRight3.default)(value);
_this.setValue(newValue);
_this.handleChange(e, newValue);
}, _this.closeOnDocumentClick = function (e) {
debug('closeOnDocumentClick()');
debug(e);
// If event happened in the dropdown, ignore it
if (_this.ref && (0, _isFunction3.default)(_this.ref.contains) && _this.ref.contains(e.target)) return;
_this.close();
}, _this.handleMouseDown = function (e) {
debug('handleMouseDown()');
var onMouseDown = _this.props.onMouseDown;
if (onMouseDown) onMouseDown(e, _this.props);
_this.isMouseDown = true;
// Do not access document when server side rendering
if (!_lib.isBrowser) return;
document.addEventListener('mouseup', _this.handleDocumentMouseUp);
}, _this.handleDocumentMouseUp = function () {
debug('handleDocumentMouseUp()');
_this.isMouseDown = false;
// Do not access document when server side rendering
if (!_lib.isBrowser) return;
document.removeEventListener('mouseup', _this.handleDocumentMouseUp);
}, _this.handleClick = function (e) {
debug('handleClick()', e);
var onClick = _this.props.onClick;
if (onClick) onClick(e, _this.props);
// prevent closeOnDocumentClick()
e.stopPropagation();
_this.toggle(e);
}, _this.handleItemClick = function (e, item) {
debug('handleItemClick()');
debug(item);
var _this$props4 = _this.props,
multiple = _this$props4.multiple,
onAddItem = _this$props4.onAddItem;
var value = item.value;
// prevent toggle() in handleClick()
e.stopPropagation();
// prevent closeOnDocumentClick() if multiple or item is disabled
if (multiple || item.disabled) {
e.nativeEvent.stopImmediatePropagation();
}
if (item.disabled) return;
// notify the onAddItem prop if this is a new value
if (onAddItem && item['data-additional']) {
onAddItem(e, (0, _extends3.default)({}, _this.props, { value: value }));
}
// notify the onChange prop that the user is trying to change value
if (multiple) {
var newValue = (0, _union3.default)(_this.state.value, [value]);
_this.setValue(newValue);
_this.handleChange(e, newValue);
} else {
_this.setValue(value);
_this.handleChange(e, value);
}
_this.closeOnChange(e);
}, _this.handleFocus = function (e) {
debug('handleFocus()');
var onFocus = _this.props.onFocus;
var focus = _this.state.focus;
if (focus) return;
if (onFocus) onFocus(e, _this.props);
_this.setState({ focus: true });
}, _this.handleBlur = function (e) {
debug('handleBlur()');
var _this$props5 = _this.props,
closeOnBlur = _this$props5.closeOnBlur,
multiple = _this$props5.multiple,
onBlur = _this$props5.onBlur,
selectOnBlur = _this$props5.selectOnBlur;
// do not "blur" when the mouse is down inside of the Dropdown
if (_this.isMouseDown) return;
if (onBlur) onBlur(e, _this.props);
if (selectOnBlur && !multiple) {
_this.makeSelectedItemActive(e);
if (closeOnBlur) _this.close();
}
_this.setState({ focus: false, searchQuery: '' });
}, _this.handleSearchChange = function (e) {
debug('handleSearchChange()');
debug(e.target.value);
// prevent propagating to this.props.onChange()
e.stopPropagation();
var _this$props6 = _this.props,
search = _this$props6.search,
onSearchChange = _this$props6.onSearchChange;
var open = _this.state.open;
var newQuery = e.target.value;
if (onSearchChange) onSearchChange(e, newQuery);
// open search dropdown on search query
if (search && newQuery && !open) _this.open();
_this.setState({
selectedIndex: 0,
searchQuery: newQuery
});
}, _this.getMenuOptions = function () {
var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _this.state.value;
var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _this.props.options;
var _this$props7 = _this.props,
multiple = _this$props7.multiple,
search = _this$props7.search,
allowAdditions = _this$props7.allowAdditions,
additionPosition = _this$props7.additionPosition,
additionLabel = _this$props7.additionLabel;
var searchQuery = _this.state.searchQuery;
var filteredOptions = options;
// filter out active options
if (multiple) {
filteredOptions = (0, _filter3.default)(filteredOptions, function (opt) {
return !(0, _includes3.default)(value, opt.value);
});
}
// filter by search query
if (search && searchQuery) {
if ((0, _isFunction3.default)(search)) {
filteredOptions = search(filteredOptions, searchQuery);
} else {
var re = new RegExp((0, _escapeRegExp3.default)(searchQuery), 'i');
filteredOptions = (0, _filter3.default)(filteredOptions, function (opt) {
return re.test(opt.text);
});
}
}
// insert the "add" item
if (allowAdditions && search && searchQuery && !(0, _some3.default)(filteredOptions, { text: searchQuery })) {
var additionLabelElement = _react2.default.isValidElement(additionLabel) ? _react2.default.cloneElement(additionLabel, { key: 'label' }) : additionLabel || '';
var addItem = {
// by using an array, we can pass multiple elements, but when doing so
// we must specify a `key` for React to know which one is which
text: [additionLabelElement, _react2.default.createElement(
'b',
{ key: 'addition' },
searchQuery
)],
value: searchQuery,
className: 'addition',
'data-additional': true
};
if (additionPosition === 'top') filteredOptions.unshift(addItem);else filteredOptions.push(addItem);
}
return filteredOptions;
}, _this.getSelectedItem = function () {
var selectedIndex = _this.state.selectedIndex;
var options = _this.getMenuOptions();
return (0, _get6.default)(options, '[' + selectedIndex + ']');
}, _this.getEnabledIndices = function (givenOptions) {
var options = givenOptions || _this.getMenuOptions();
return (0, _reduce3.default)(options, function (memo, item, index) {
if (!item.disabled) memo.push(index);
return memo;
}, []);
}, _this.getItemByValue = function (value) {
var options = _this.props.options;
return (0, _find3.default)(options, { value: value });
}, _this.getMenuItemIndexByValue = function (value, givenOptions) {
var options = givenOptions || _this.getMenuOptions();
return (0, _findIndex3.default)(options, ['value', value]);
}, _this.getDropdownAriaOptions = function (ElementType) {
var _this$props8 = _this.props,
loading = _this$props8.loading,
disabled = _this$props8.disabled,
search = _this$props8.search,
multiple = _this$props8.multiple;
var open = _this.state.open;
var ariaOptions = {
role: search ? 'combobox' : 'listbox',
'aria-busy': loading,
'aria-disabled': disabled,
'aria-expanded': !!open
};
if (ariaOptions.role === 'listbox') {
ariaOptions['aria-multiselectable'] = multiple;
}
return ariaOptions;
}, _this.setValue = function (value) {
debug('setValue()');
debug('value', value);
var newState = {
searchQuery: ''
};
var _this$props9 = _this.props,
multiple = _this$props9.multiple,
search = _this$props9.search;
if (multiple && search && _this.searchRef) _this.searchRef.focus();
_this.trySetState({ value: value }, newState);
_this.setSelectedIndex(value);
}, _this.setSelectedIndex = function () {
var value = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _this.state.value;
var optionsProps = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _this.props.options;
var multiple = _this.props.multiple;
var selectedIndex = _this.state.selectedIndex;
var options = _this.getMenuOptions(value, optionsProps);
var enabledIndicies = _this.getEnabledIndices(options);
var newSelectedIndex = void 0;
// update the selected index
if (!selectedIndex || selectedIndex < 0) {
var firstIndex = enabledIndicies[0];
// Select the currently active item, if none, use the first item.
// Multiple selects remove active items from the list,
// their initial selected index should be 0.
newSelectedIndex = multiple ? firstIndex : _this.getMenuItemIndexByValue(value, options) || enabledIndicies[0];
} else if (multiple) {
// multiple selects remove options from the menu as they are made active
// keep the selected index within range of the remaining items
if (selectedIndex >= options.length - 1) {
newSelectedIndex = enabledIndicies[enabledIndicies.length - 1];
}
} else {
var activeIndex = _this.getMenuItemIndexByValue(value, options);
// regular selects can only have one active item
// set the selected index to the currently active item
newSelectedIndex = (0, _includes3.default)(enabledIndicies, activeIndex) ? activeIndex : undefined;
}
if (!newSelectedIndex || newSelectedIndex < 0) {
newSelectedIndex = enabledIndicies[0];
}
_this.setState({ selectedIndex: newSelectedIndex });
}, _this.handleLabelClick = function (e, labelProps) {
debug('handleLabelClick()');
// prevent focusing search input on click
e.stopPropagation();
_this.setState({ selectedLabel: labelProps.value });
var onLabelClick = _this.props.onLabelClick;
if (onLabelClick) onLabelClick(e, labelProps);
}, _this.handleLabelRemove = function (e, labelProps) {
debug('handleLabelRemove()');
// prevent focusing search input on click
e.stopPropagation();
var value = _this.state.value;
var newValue = (0, _without3.default)(value, labelProps.value);
debug('label props:', labelProps);
debug('current value:', value);
debug('remove value:', labelProps.value);
debug('new value:', newValue);
_this.setValue(newValue);
_this.handleChange(e, newValue);
}, _this.moveSelectionBy = function (offset) {
var startIndex = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _this.state.selectedIndex;
debug('moveSelectionBy()');
debug('offset: ' + offset);
var options = _this.getMenuOptions();
var lastIndex = options.length - 1;
// Prevent infinite loop
if ((0, _every3.default)(options, 'disabled')) return;
// next is after last, wrap to beginning
// next is before first, wrap to end
var nextIndex = startIndex + offset;
if (nextIndex > lastIndex) nextIndex = 0;else if (nextIndex < 0) nextIndex = lastIndex;
if (options[nextIndex].disabled) return _this.moveSelectionBy(offset, nextIndex);
_this.setState({ selectedIndex: nextIndex });
_this.scrollSelectedItemIntoView();
}, _this.handleSearchRef = function (c) {
return _this.searchRef = c;
}, _this.handleSizerRef = function (c) {
return _this.sizerRef = c;
}, _this.handleRef = function (c) {
return _this.ref = c;
}, _this.scrollSelectedItemIntoView = function () {
debug('scrollSelectedItemIntoView()');
if (!_this.ref) return;
var menu = _this.ref.querySelector('.menu.visible');
if (!menu) return;
var item = menu.querySelector('.item.selected');
if (!item) return;
debug('menu: ' + menu);
debug('item: ' + item);
var isOutOfUpperView = item.offsetTop < menu.scrollTop;
var isOutOfLowerView = item.offsetTop + item.clientHeight > menu.scrollTop + menu.clientHeight;
if (isOutOfUpperView) {
menu.scrollTop = item.offsetTop;
} else if (isOutOfLowerView) {
menu.scrollTop = item.offsetTop + item.clientHeight - menu.clientHeight;
}
}, _this.open = function (e) {
debug('open()');
var _this$props10 = _this.props,
disabled = _this$props10.disabled,
onOpen = _this$props10.onOpen,
search = _this$props10.search;
if (disabled) return;
if (search && _this.searchRef) _this.searchRef.focus();
if (onOpen) onOpen(e, _this.props);
_this.trySetState({ open: true });
_this.scrollSelectedItemIntoView();
}, _this.close = function (e) {
debug('close()');
var onClose = _this.props.onClose;
if (onClose) onClose(e, _this.props);
_this.trySetState({ open: false });
}, _this.handleClose = function () {
debug('handleClose()');
var hasSearchFocus = document.activeElement === _this.searchRef;
var hasDropdownFocus = document.activeElement === _this.ref;
var hasFocus = hasSearchFocus || hasDropdownFocus;
// https://github.com/Semantic-Org/Semantic-UI-React/issues/627
// Blur the Dropdown on close so it is blurred after selecting an item.
// This is to prevent it from re-opening when switching tabs after selecting an item.
if (!hasSearchFocus) {
_this.ref.blur();
}
// We need to keep the virtual model in sync with the browser focus change
// https://github.com/Semantic-Org/Semantic-UI-React/issues/692
_this.setState({ focus: hasFocus });
}, _this.toggle = function (e) {
if (!_this.state.open) {
_this.open(e);
return;
}
var search = _this.props.search;
var options = _this.getMenuOptions();
if (search && (0, _isEmpty3.default)(options)) {
e.preventDefault();
return;
}
_this.close(e);
}, _this.renderText = function () {
var _this$props11 = _this.props,
multiple = _this$props11.multiple,
placeholder = _this$props11.placeholder,
search = _this$props11.search,
text = _this$props11.text;
var _this$state2 = _this.state,
searchQuery = _this$state2.searchQuery,
value = _this$state2.value,
open = _this$state2.open;
var hasValue = multiple ? !(0, _isEmpty3.default)(value) : !(0, _isNil3.default)(value) && value !== '';
var classes = (0, _classnames2.default)(placeholder && !hasValue && 'default', 'text', search && searchQuery && 'filtered');
var _text = placeholder;
if (searchQuery) {
_text = null;
} else if (text) {
_text = text;
} else if (open && !multiple) {
_text = (0, _get6.default)(_this.getSelectedItem(), 'text');
} else if (hasValue) {
_text = (0, _get6.default)(_this.getItemByValue(value), 'text');
}
return _react2.default.createElement(
'div',
{ className: classes },
_text
);
}, _this.renderHiddenInput = function () {
debug('renderHiddenInput()');
var value = _this.state.value;
var _this$props12 = _this.props,
multiple = _this$props12.multiple,
name = _this$props12.name,
options = _this$props12.options,
selection = _this$props12.selection;
debug('name: ' + name);
debug('selection: ' + selection);
debug('value: ' + value);
if (!selection) return null;
// a dropdown without an active item will have an empty string value
return _react2.default.createElement(
'select',
{ type: 'hidden', 'aria-hidden': 'true', name: name, value: value, multiple: multiple },
_react2.default.createElement('option', { value: '' }),
(0, _map3.default)(options, function (option) {
return _react2.default.createElement(
'option',
{ key: option.value, value: option.value },
option.text
);
})
);
}, _this.renderSearchInput = function () {
var _this$props13 = _this.props,
disabled = _this$props13.disabled,
search = _this$props13.search,
name = _this$props13.name,
tabIndex = _this$props13.tabIndex;
var searchQuery = _this.state.searchQuery;
if (!search) return null;
// tabIndex
var computedTabIndex = void 0;
if (!(0, _isNil3.default)(tabIndex)) computedTabIndex = tabIndex;else computedTabIndex = disabled ? -1 : 0;
// resize the search input, temporarily show the sizer so we can measure it
var searchWidth = void 0;
if (_this.sizerRef && searchQuery) {
_this.sizerRef.style.display = 'inline';
_this.sizerRef.textContent = searchQuery;
searchWidth = Math.ceil(_this.sizerRef.getBoundingClientRect().width);
_this.sizerRef.style.removeProperty('display');
}
return _react2.default.createElement('input', {
value: searchQuery,
type: 'text',
'aria-autocomplete': 'list',
onChange: _this.handleSearchChange,
className: 'search',
name: [name, 'search'].join('-'),
autoComplete: 'off',
tabIndex: computedTabIndex,
style: { width: searchWidth },
ref: _this.handleSearchRef
});
}, _this.renderSearchSizer = function () {
var _this$props14 = _this.props,
search = _this$props14.search,
multiple = _this$props14.multiple;
if (!(search && multiple)) return null;
return _react2.default.createElement('span', { className: 'sizer', ref: _this.handleSizerRef });
}, _this.renderLabels = function () {
debug('renderLabels()');
var _this$props15 = _this.props,
multiple = _this$props15.multiple,
renderLabel = _this$props15.renderLabel;
var _this$state3 = _this.state,
selectedLabel = _this$state3.selectedLabel,
value = _this$state3.value;
if (!multiple || (0, _isEmpty3.default)(value)) {
return;
}
var selectedItems = (0, _map3.default)(value, _this.getItemByValue);
debug('selectedItems', selectedItems);
// if no item could be found for a given state value the selected item will be undefined
// compact the selectedItems so we only have actual objects left
return (0, _map3.default)((0, _compact3.default)(selectedItems), function (item, index) {
var defaultProps = {
active: item.value === selectedLabel,
as: 'a',
key: item.value,
onClick: _this.handleLabelClick,
onRemove: _this.handleLabelRemove,
value: item.value
};
return _Label2.default.create(renderLabel(item, index, defaultProps), { defaultProps: defaultProps });
});
}, _this.renderOptions = function () {
var _this$props16 = _this.props,
multiple = _this$props16.multiple,
search = _this$props16.search,
noResultsMessage = _this$props16.noResultsMessage;
var _this$state4 = _this.state,
selectedIndex = _this$state4.selectedIndex,
value = _this$state4.value;
var options = _this.getMenuOptions();
if (noResultsMessage !== null && search && (0, _isEmpty3.default)(options)) {
return _react2.default.createElement(
'div',
{ className: 'message' },
noResultsMessage
);
}
var isActive = multiple ? function (optValue) {
return (0, _includes3.default)(value, optValue);
} : function (optValue) {
return optValue === value;
};
return (0, _map3.default)(options, function (opt, i) {
return _react2.default.createElement(_DropdownItem2.default, (0, _extends3.default)({
key: opt.value + '-' + i,
active: isActive(opt.value),
onClick: _this.handleItemClick,
selected: selectedIndex === i
}, opt, {
// Needed for handling click events on disabled items
style: (0, _extends3.default)({}, opt.style, { pointerEvents: 'all' })
}));
});
}, _this.renderMenu = function () {
var _this$props17 = _this.props,
children = _this$props17.children,
header = _this$props17.header;
var open = _this.state.open;
var menuClasses = open ? 'visible' : '';
var ariaOptions = _this.getDropdownMenuAriaOptions();
// single menu child
if (!(0, _isNil3.default)(children)) {
var menuChild = _react.Children.only(children);
var className = (0, _classnames2.default)(menuClasses, menuChild.props.className);
return (0, _react.cloneElement)(menuChild, (0, _extends3.default)({ className: className }, ariaOptions));
}
return _react2.default.createElement(
_DropdownMenu2.default,
(0, _extends3.default)({}, ariaOptions, { className: menuClasses }),
_DropdownHeader2.default.create(header),
_this.renderOptions()
);
}, _temp), (0, _possibleConstructorReturn3.default)(_this, _ret);
}
(0, _createClass3.default)(Dropdown, [{
key: 'componentWillMount',
value: function componentWillMount() {
if ((0, _get4.default)(Dropdown.prototype.__proto__ || Object.getPrototypeOf(Dropdown.prototype), 'componentWillMount', this)) (0, _get4.default)(Dropdown.prototype.__proto__ || Object.getPrototypeOf(Dropdown.prototype), 'componentWillMount', this).call(this);
debug('componentWillMount()');
var _state = this.state,
open = _state.open,
value = _state.value;
this.setValue(value);
if (open) this.open();
}
}, {
key: 'shouldComponentUpdate',
value: function shouldComponentUpdate(nextProps, nextState) {
return !(0, _isEqual3.default)(nextProps, this.props) || !(0, _isEqual3.default)(nextState, this.state);
}
}, {
key: 'componentWillReceiveProps',
value: function componentWillReceiveProps(nextProps) {
(0, _get4.default)(Dropdown.prototype.__proto__ || Object.getPrototypeOf(Dropdown.prototype), 'componentWillReceiveProps', this).call(this, nextProps);
debug('componentWillReceiveProps()');
// TODO objectDiff still runs in prod, stop it
debug('to props:', (0, _lib.objectDiff)(this.props, nextProps));
/* eslint-disable no-console */
if (process.env.NODE_ENV !== 'production') {
// in development, validate value type matches dropdown type
var isNextValueArray = Array.isArray(nextProps.value);
var hasValue = (0, _has3.default)(nextProps, 'value');
if (hasValue && nextProps.multiple && !isNextValueArray) {
console.error('Dropdown `value` must be an array when `multiple` is set.' + (' Received type: `' + Object.prototype.toString.call(nextProps.value) + '`.'));
} else if (hasValue && !nextProps.multiple && isNextValueArray) {
console.error('Dropdown `value` must not be an array when `multiple` is not set.' + ' Either set `multiple={true}` or use a string or number value.');
}
}
/* eslint-enable no-console */
if (!(0, _isEqual3.default)(nextProps.value, this.props.value)) {
debug('value changed, setting', nextProps.value);
this.setValue(nextProps.value);
}
if (!(0, _isEqual3.default)(nextProps.options, this.props.options)) {
this.setSelectedIndex(undefined, nextProps.options);
}
}
}, {
key: 'componentDidUpdate',
value: function componentDidUpdate(prevProps, prevState) {
// eslint-disable-line complexity
debug('componentDidUpdate()');
// TODO objectDiff still runs in prod, stop it
debug('to state:', (0, _lib.objectDiff)(prevState, this.state));
// Do not access document when server side rendering
if (!_lib.isBrowser) return;
// focused / blurred
if (!prevState.focus && this.state.focus) {
debug('dropdown focused');
if (!this.isMouseDown) {
var openOnFocus = this.props.openOnFocus;
debug('mouse is not down, opening');
if (openOnFocus) this.open();
}
if (!this.state.open) {
document.addEventListener('keydown', this.openOnArrow);
document.addEventListener('keydown', this.openOnSpace);
} else {
document.addEventListener('keydown', this.moveSelectionOnKeyDown);
document.addEventListener('keydown', this.selectItemOnEnter);
}
document.addEventListener('keydown', this.removeItemOnBackspace);
} else if (prevState.focus && !this.state.focus) {
debug('dropdown blurred');
var closeOnBlur = this.props.closeOnBlur;
if (!this.isMouseDown && closeOnBlur) {
debug('mouse is not down and closeOnBlur=true, closing');
this.close();
}
document.removeEventListener('keydown', this.openOnArrow);
document.removeEventListener('keydown', this.openOnSpace);
document.removeEventListener('keydown', this.moveSelectionOnKeyDown);
document.removeEventListener('keydown', this.selectItemOnEnter);
document.removeEventListener('keydown', this.removeItemOnBackspace);
}
// opened / closed
if (!prevState.open && this.state.open) {
debug('dropdown opened');
document.addEventListener('keydown', this.closeOnEscape);
document.addEventListener('keydown', this.moveSelectionOnKeyDown);
document.addEventListener('keydown', this.selectItemOnEnter);
document.addEventListener('keydown', this.removeItemOnBackspace);
document.addEventListener('click', this.closeOnDocumentClick);
document.removeEventListener('keydown', this.openOnArrow);
document.removeEventListener('keydown', this.openOnSpace);
this.scrollSelectedItemIntoView();
} else if (prevState.open && !this.state.open) {
debug('dropdown closed');
this.handleClose();
document.removeEventListener('keydown', this.closeOnEscape);
document.removeEventListener('keydown', this.moveSelectionOnKeyDown);
document.removeEventListener('keydown', this.selectItemOnEnter);
document.removeEventListener('click', this.closeOnDocumentClick);
if (!this.state.focus) {
document.removeEventListener('keydown', this.removeItemOnBackspace);
}
}
}
}, {
key: 'componentWillUnmount',
value: function componentWillUnmount() {
debug('componentWillUnmount()');
// Do not access document when server side rendering
if (!_lib.isBrowser) return;
document.removeEventListener('keydown', this.openOnArrow);
document.removeEventListener('keydown', this.openOnSpace);
document.removeEventListener('keydown', this.moveSelectionOnKeyDown);
document.removeEventListener('keydown', this.selectItemOnEnter);
document.removeEventListener('keydown', this.removeItemOnBackspace);
document.removeEventListener('keydown', this.closeOnEscape);
document.removeEventListener('click', this.closeOnDocumentClick);
}
// ----------------------------------------
// Document Event Handlers
// ----------------------------------------
// onChange needs to receive a value
// can't rely on props.value if we are controlled
// ----------------------------------------
// Component Event Handlers
// ----------------------------------------
// ----------------------------------------
// Getters
// ----------------------------------------
// There are times when we need to calculate the options based on a value
// that hasn't yet been persisted to state.
}, {
key: 'getDropdownMenuAriaOptions',
value: function getDropdownMenuAriaOptions() {
var _props = this.props,
search = _props.search,
multiple = _props.multiple;
var ariaOptions = {};
if (search) {
ariaOptions['aria-multiselectable'] = multiple;
ariaOptions.role = 'listbox';
}
return ariaOptions;
}
// ----------------------------------------
// Setters
// ----------------------------------------
// ----------------------------------------
// Refs
// ----------------------------------------
// ----------------------------------------
// Behavior
// ----------------------------------------
// ----------------------------------------
// Render
// ----------------------------------------
}, {
key: 'render',
value: function render() {
debug('render()');
debug('props', this.props);
debug('state', this.state);
var open = this.state.open;
var _props2 = this.props,
basic = _props2.basic,
button = _props2.button,
className = _props2.className,
compact = _props2.compact,
fluid = _props2.fluid,
floating = _props2.floating,
icon = _props2.icon,
inline = _props2.inline,
item = _props2.item,
labeled = _props2.labeled,
multiple = _props2.multiple,
pointing = _props2.pointing,
search = _props2.search,
selection = _props2.selection,
simple = _props2.simple,
loading = _props2.loading,
error = _props2.error,
disabled = _props2.disabled,
scrolling = _props2.scrolling,
tabIndex = _props2.tabIndex,
trigger = _props2.trigger;
// Classes
var classes = (0, _classnames2.default)('ui', (0, _lib.useKeyOnly)(open, 'active visible'), (0, _lib.useKeyOnly)(disabled, 'disabled'), (0, _lib.useKeyOnly)(error, 'error'), (0, _lib.useKeyOnly)(loading, 'loading'), (0, _lib.useKeyOnly)(basic, 'basic'), (0, _lib.useKeyOnly)(button, 'button'), (0, _lib.useKeyOnly)(compact, 'compact'), (0, _lib.useKeyOnly)(fluid, 'fluid'), (0, _lib.useKeyOnly)(floating, 'floating'), (0, _lib.useKeyOnly)(inline, 'inline'),
// TODO: consider augmentation to render Dropdowns as Button/Menu, solves icon/link item issues
// https://github.com/Semantic-Org/Semantic-UI-React/issues/401#issuecomment-240487229
// TODO: the icon class is only required when a dropdown is a button
// useKeyOnly(icon, 'icon'),
(0, _lib.useKeyOnly)(labeled, 'labeled'), (0, _lib.useKeyOnly)(item, 'item'), (0, _lib.useKeyOnly)(multiple, 'multiple'), (0, _lib.useKeyOnly)(search, 'search'), (0, _lib.useKeyOnly)(selection, 'selection'), (0, _lib.useKeyOnly)(simple, 'simple'), (0, _lib.useKeyOnly)(scrolling, 'scrolling'), (0, _lib.useKeyOrValueAndKey)(pointing, 'pointing'), className, 'dropdown');
var rest = (0, _lib.getUnhandledProps)(Dropdown, this.props);
var ElementType = (0, _lib.getElementType)(Dropdown, this.props);
var ariaOptions = this.getDropdownAriaOptions(ElementType, this.props);
var computedTabIndex = void 0;
if (!(0, _isNil3.default)(tabIndex)) {
computedTabIndex = tabIndex;
} else if (!search) {
// don't set a root node tabIndex as the search input has its own tabIndex
computedTabIndex = disabled ? -1 : 0;
}
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, ariaOptions, {
className: classes,
onBlur: this.handleBlur,
onClick: this.handleClick,
onMouseDown: this.handleMouseDown,
onFocus: this.handleFocus,
onChange: this.handleChange,
tabIndex: computedTabIndex,
ref: this.handleRef
}),
this.renderHiddenInput(),
this.renderLabels(),
this.renderSearchInput(),
this.renderSearchSizer(),
trigger || this.renderText(),
_Icon2.default.create(icon),
this.renderMenu()
);
}
}]);
return Dropdown;
}(_lib.AutoControlledComponent);
Dropdown.defaultProps = {
additionLabel: 'Add ',
additionPosition: 'top',
icon: 'dropdown',
noResultsMessage: 'No results found.',
renderLabel: function renderLabel(_ref2) {
var text = _ref2.text;
return text;
},
selectOnBlur: true,
openOnFocus: true,
closeOnBlur: true
};
Dropdown.autoControlledProps = ['open', 'value', 'selectedLabel'];
Dropdown._meta = {
name: 'Dropdown',
type: _lib.META.TYPES.MODULE
};
Dropdown.Divider = _DropdownDivider2.default;
Dropdown.Header = _DropdownHeader2.default;
Dropdown.Item = _DropdownItem2.default;
Dropdown.Menu = _DropdownMenu2.default;
exports.default = Dropdown;
process.env.NODE_ENV !== "production" ? Dropdown.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Label prefixed to an option added by a user. */
additionLabel: _propTypes2.default.oneOfType([_propTypes2.default.element, _propTypes2.default.string]),
/** Position of the `Add: ...` option in the dropdown list ('top' or 'bottom'). */
additionPosition: _propTypes2.default.oneOf(['top', 'bottom']),
/**
* Allow user additions to the list of options (boolean).
* Requires the use of `selection`, `options` and `search`.
*/
allowAdditions: _lib.customPropTypes.every([_lib.customPropTypes.demand(['options', 'selection', 'search']), _propTypes2.default.bool]),
/** A Dropdown can reduce its complexity. */
basic: _propTypes2.default.bool,
/** Format the Dropdown to appear as a button. */
button: _propTypes2.default.bool,
/** Primary content. */
children: _lib.customPropTypes.every([_lib.customPropTypes.disallow(['options', 'selection']), _lib.customPropTypes.givenProps({ children: _propTypes2.default.any.isRequired }, _react2.default.PropTypes.element.isRequired)]),
/** Additional classes. */
className: _propTypes2.default.string,
/** Whether or not the menu should close when the dropdown is blurred. */
closeOnBlur: _propTypes2.default.bool,
/**
* Whether or not the menu should close when a value is selected from the dropdown.
* By default, multiple selection dropdowns will remain open on change, while single
* selection dropdowns will close on change.
*/
closeOnChange: _propTypes2.default.bool,
/** A compact dropdown has no minimum width. */
compact: _propTypes2.default.bool,
/** Initial value of open. */
defaultOpen: _propTypes2.default.bool,
/** Currently selected label in multi-select. */
defaultSelectedLabel: _lib.customPropTypes.every([_lib.customPropTypes.demand(['multiple']), _propTypes2.default.oneOfType([_propTypes2.default.number, _propTypes2.default.string])]),
/** Initial value or value array if multiple. */
defaultValue: _propTypes2.default.oneOfType([_propTypes2.default.number, _propTypes2.default.string, _propTypes2.default.arrayOf(_propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.number]))]),
/** A disabled dropdown menu or item does not allow user interaction. */
disabled: _propTypes2.default.bool,
/** An errored dropdown can alert a user to a problem. */
error: _propTypes2.default.bool,
/** A dropdown menu can contain floated content. */
floating: _propTypes2.default.bool,
/** A dropdown can take the full width of its parent */
fluid: _propTypes2.default.bool,
/** A dropdown menu can contain a header. */
header: _propTypes2.default.node,
/** Shorthand for Icon. */
icon: _propTypes2.default.oneOfType([_propTypes2.default.node, _propTypes2.default.object]),
/** A dropdown can be formatted to appear inline in other content. */
inline: _propTypes2.default.bool,
/** A dropdown can be formatted as a Menu item. */
item: _propTypes2.default.bool,
/** A dropdown can be labeled. */
labeled: _propTypes2.default.bool,
/** A dropdown can show that it is currently loading data. */
loading: _propTypes2.default.bool,
/** A selection dropdown can allow multiple selections. */
multiple: _propTypes2.default.bool,
/** Name of the hidden input which holds the value. */
name: _propTypes2.default.string,
/** Message to display when there are no results. */
noResultsMessage: _propTypes2.default.string,
/**
* Called when a user adds a new item. Use this to update the options list.
*
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {object} data - All props and the new item's value.
*/
onAddItem: _propTypes2.default.func,
/**
* Called on blur.
*
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {object} data - All props.
*/
onBlur: _propTypes2.default.func,
/**
* Called when the user attempts to change the value.
*
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {object} data - All props and proposed value.
*/
onChange: _propTypes2.default.func,
/**
* Called on click.
*
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {object} data - All props.
*/
onClick: _propTypes2.default.func,
/**
* Called when a close event happens.
*
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {object} data - All props.
*/
onClose: _propTypes2.default.func,
/**
* Called on focus.
*
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {object} data - All props.
*/
onFocus: _propTypes2.default.func,
/**
* Called when a multi-select label is clicked.
*
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {object} data - All label props.
*/
onLabelClick: _propTypes2.default.func,
/**
* Called on mousedown.
*
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {object} data - All props.
*/
onMouseDown: _propTypes2.default.func,
/**
* Called when an open event happens.
*
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {object} data - All props.
*/
onOpen: _propTypes2.default.func,
/**
* Called on search input change.
*
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {string} value - Current value of search input.
*/
onSearchChange: _propTypes2.default.func,
/** Controls whether or not the dropdown menu is displayed. */
open: _propTypes2.default.bool,
/** Whether or not the menu should open when the dropdown is focused. */
openOnFocus: _propTypes2.default.bool,
/** Array of Dropdown.Item props e.g. `{ text: '', value: '' }` */
options: _lib.customPropTypes.every([_lib.customPropTypes.disallow(['children']), _propTypes2.default.arrayOf(_propTypes2.default.shape(_DropdownItem2.default.propTypes))]),
/** Placeholder text. */
placeholder: _propTypes2.default.string,
/** A dropdown can be formatted so that its menu is pointing. */
pointing: _propTypes2.default.oneOfType([_propTypes2.default.bool, _propTypes2.default.oneOf(['left', 'right', 'top', 'top left', 'top right', 'bottom', 'bottom left', 'bottom right'])]),
/**
* Mapped over the active items and returns shorthand for the active item Labels.
* Only applies to `multiple` Dropdowns.
*
* @param {object} item - A currently active dropdown item.
* @param {number} index - The current index.
* @param {object} defaultLabelProps - The default props for an active item Label.
* @returns {*} Shorthand for a Label.
*/
renderLabel: _propTypes2.default.func,
/** A dropdown can have its menu scroll. */
scrolling: _propTypes2.default.bool,
/**
* A selection dropdown can allow a user to search through a large list of choices.
* Pass a function here to replace the default search.
*/
search: _propTypes2.default.oneOfType([_propTypes2.default.bool, _propTypes2.default.func]),
// TODO 'searchInMenu' or 'search='in menu' or ??? How to handle this markup and functionality?
/** Define whether the highlighted item should be selected on blur. */
selectOnBlur: _propTypes2.default.bool,
/** Currently selected label in multi-select. */
selectedLabel: _lib.customPropTypes.every([_lib.customPropTypes.demand(['multiple']), _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.number])]),
/** A dropdown can be used to select between choices in a form. */
selection: _lib.customPropTypes.every([_lib.customPropTypes.disallow(['children']), _lib.customPropTypes.demand(['options']), _propTypes2.default.bool]),
/** A simple dropdown can open without Javascript. */
simple: _propTypes2.default.bool,
/** A dropdown can receive focus. */
tabIndex: _propTypes2.default.oneOfType([_propTypes2.default.number, _propTypes2.default.string]),
/** The text displayed in the dropdown, usually for the active item. */
text: _propTypes2.default.string,
/** Custom element to trigger the menu to become visible. Takes place of 'text'. */
trigger: _lib.customPropTypes.every([_lib.customPropTypes.disallow(['selection', 'text']), _propTypes2.default.node]),
/** Current value or value array if multiple. Creates a controlled component. */
value: _propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.number, _propTypes2.default.arrayOf(_propTypes2.default.oneOfType([_propTypes2.default.string, _propTypes2.default.number]))])
} : void 0;
Dropdown.handledProps = ['additionLabel', 'additionPosition', 'allowAdditions', 'as', 'basic', 'button', 'children', 'className', 'closeOnBlur', 'closeOnChange', 'compact', 'defaultOpen', 'defaultSelectedLabel', 'defaultValue', 'disabled', 'error', 'floating', 'fluid', 'header', 'icon', 'inline', 'item', 'labeled', 'loading', 'multiple', 'name', 'noResultsMessage', 'onAddItem', 'onBlur', 'onChange', 'onClick', 'onClose', 'onFocus', 'onLabelClick', 'onMouseDown', 'onOpen', 'onSearchChange', 'open', 'openOnFocus', 'options', 'placeholder', 'pointing', 'renderLabel', 'scrolling', 'search', 'selectOnBlur', 'selectedLabel', 'selection', 'simple', 'tabIndex', 'text', 'trigger', 'value'];
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 | 1 1 1 1 1 1 1 1 1 1 4 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* A dropdown menu can contain dividers to separate related content.
*/
function DropdownDivider(props) {
var className = props.className;
var classes = (0, _classnames2.default)('divider', className);
var rest = (0, _lib.getUnhandledProps)(DropdownDivider, props);
var ElementType = (0, _lib.getElementType)(DropdownDivider, props);
return _react2.default.createElement(ElementType, (0, _extends3.default)({}, rest, { className: classes }));
}
DropdownDivider.handledProps = ['as', 'className'];
DropdownDivider._meta = {
name: 'DropdownDivider',
parent: 'Dropdown',
type: _lib.META.TYPES.MODULE
};
process.env.NODE_ENV !== "production" ? DropdownDivider.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Additional classes. */
className: _propTypes2.default.string
} : void 0;
exports.default = DropdownDivider;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | 1 1 1 1 1 1 1 1 1 1 1 1 1 1 6 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _isNil2 = require('lodash/isNil');
var _isNil3 = _interopRequireDefault(_isNil2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
var _Icon = require('../../elements/Icon');
var _Icon2 = _interopRequireDefault(_Icon);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* A dropdown menu can contain a header.
*/
function DropdownHeader(props) {
var children = props.children,
className = props.className,
content = props.content,
icon = props.icon;
var classes = (0, _classnames2.default)('header', className);
var rest = (0, _lib.getUnhandledProps)(DropdownHeader, props);
var ElementType = (0, _lib.getElementType)(DropdownHeader, props);
if (!(0, _isNil3.default)(children)) return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
children
);
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
_Icon2.default.create(icon),
content
);
}
DropdownHeader.handledProps = ['as', 'children', 'className', 'content', 'icon'];
DropdownHeader._meta = {
name: 'DropdownHeader',
parent: 'Dropdown',
type: _lib.META.TYPES.MODULE
};
process.env.NODE_ENV !== "production" ? DropdownHeader.propTypes = {
/** An element type to render as (string or function) */
as: _lib.customPropTypes.as,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string,
/** Shorthand for primary content. */
content: _lib.customPropTypes.contentShorthand,
/** Shorthand for Icon. */
icon: _lib.customPropTypes.itemShorthand
} : void 0;
DropdownHeader.create = (0, _lib.createShorthandFactory)(DropdownHeader, function (content) {
return { content: content };
});
exports.default = DropdownHeader;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 | 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 13 1 1 1 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
var _createClass2 = require('babel-runtime/helpers/createClass');
var _createClass3 = _interopRequireDefault(_createClass2);
var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
var _inherits2 = require('babel-runtime/helpers/inherits');
var _inherits3 = _interopRequireDefault(_inherits2);
var _isNil2 = require('lodash/isNil');
var _isNil3 = _interopRequireDefault(_isNil2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
var _Flag = require('../../elements/Flag');
var _Flag2 = _interopRequireDefault(_Flag);
var _Icon = require('../../elements/Icon');
var _Icon2 = _interopRequireDefault(_Icon);
var _Image = require('../../elements/Image');
var _Image2 = _interopRequireDefault(_Image);
var _Label = require('../../elements/Label');
var _Label2 = _interopRequireDefault(_Label);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* An item sub-component for Dropdown component.
*/
var DropdownItem = function (_Component) {
(0, _inherits3.default)(DropdownItem, _Component);
function DropdownItem() {
var _ref;
var _temp, _this, _ret;
(0, _classCallCheck3.default)(this, DropdownItem);
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return _ret = (_temp = (_this = (0, _possibleConstructorReturn3.default)(this, (_ref = DropdownItem.__proto__ || Object.getPrototypeOf(DropdownItem)).call.apply(_ref, [this].concat(args))), _this), _this.handleClick = function (e) {
var onClick = _this.props.onClick;
if (onClick) onClick(e, _this.props);
}, _temp), (0, _possibleConstructorReturn3.default)(_this, _ret);
}
(0, _createClass3.default)(DropdownItem, [{
key: 'render',
value: function render() {
var _props = this.props,
active = _props.active,
children = _props.children,
className = _props.className,
content = _props.content,
disabled = _props.disabled,
description = _props.description,
flag = _props.flag,
icon = _props.icon,
image = _props.image,
label = _props.label,
selected = _props.selected,
text = _props.text;
var classes = (0, _classnames2.default)((0, _lib.useKeyOnly)(active, 'active'), (0, _lib.useKeyOnly)(disabled, 'disabled'), (0, _lib.useKeyOnly)(selected, 'selected'), 'item', className);
// add default dropdown icon if item contains another menu
var iconName = (0, _isNil3.default)(icon) ? _lib.childrenUtils.someByType(children, 'DropdownMenu') && 'dropdown' : icon;
var rest = (0, _lib.getUnhandledProps)(DropdownItem, this.props);
var ElementType = (0, _lib.getElementType)(DropdownItem, this.props);
var ariaOptions = {
role: 'option',
'aria-disabled': disabled,
'aria-checked': active,
'aria-selected': selected
};
if (!(0, _isNil3.default)(children)) {
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, ariaOptions, { className: classes, onClick: this.handleClick }),
children
);
}
var flagElement = _Flag2.default.create(flag);
var iconElement = _Icon2.default.create(iconName);
var imageElement = _Image2.default.create(image);
var labelElement = _Label2.default.create(label);
var descriptionElement = (0, _lib.createShorthand)('span', function (val) {
return { children: val };
}, description, { defaultProps: { className: 'description' } });
var textElement = (0, _lib.createShorthand)('span', function (val) {
return { children: val };
}, content || text, { defaultProps: { className: 'text' } });
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, ariaOptions, { className: classes, onClick: this.handleClick }),
imageElement,
iconElement,
flagElement,
labelElement,
descriptionElement,
textElement
);
}
}]);
return DropdownItem;
}(_react.Component);
DropdownItem._meta = {
name: 'DropdownItem',
parent: 'Dropdown',
type: _lib.META.TYPES.MODULE
};
exports.default = DropdownItem;
process.env.NODE_ENV !== "production" ? DropdownItem.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Style as the currently chosen item. */
active: _propTypes2.default.bool,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string,
/** Shorthand for primary content. */
content: _lib.customPropTypes.contentShorthand,
/** Additional text with less emphasis. */
description: _lib.customPropTypes.itemShorthand,
/** A dropdown item can be disabled. */
disabled: _propTypes2.default.bool,
/** Shorthand for Flag. */
flag: _lib.customPropTypes.itemShorthand,
/** Shorthand for Icon. */
icon: _lib.customPropTypes.itemShorthand,
/** Shorthand for Image. */
image: _lib.customPropTypes.itemShorthand,
/** Shorthand for Label. */
label: _lib.customPropTypes.itemShorthand,
/**
* Called on click.
*
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {object} data - All props.
*/
onClick: _propTypes2.default.func,
/**
* The item currently selected by keyboard shortcut.
* This is not the active item.
*/
selected: _propTypes2.default.bool,
/** Display text. */
text: _lib.customPropTypes.contentShorthand,
/** Stored value. */
value: _propTypes2.default.oneOfType([_propTypes2.default.number, _propTypes2.default.string])
} : void 0;
DropdownItem.handledProps = ['active', 'as', 'children', 'className', 'content', 'description', 'disabled', 'flag', 'icon', 'image', 'label', 'onClick', 'selected', 'text', 'value'];
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | 1 1 1 1 1 1 1 1 1 1 4 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* A dropdown menu can contain a menu.
*/
function DropdownMenu(props) {
var children = props.children,
className = props.className,
scrolling = props.scrolling;
var classes = (0, _classnames2.default)((0, _lib.useKeyOnly)(scrolling, 'scrolling'), 'menu transition', className);
var rest = (0, _lib.getUnhandledProps)(DropdownMenu, props);
var ElementType = (0, _lib.getElementType)(DropdownMenu, props);
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
children
);
}
DropdownMenu.handledProps = ['as', 'children', 'className', 'scrolling'];
DropdownMenu._meta = {
name: 'DropdownMenu',
parent: 'Dropdown',
type: _lib.META.TYPES.MODULE
};
process.env.NODE_ENV !== "production" ? DropdownMenu.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string,
/** A dropdown menu can scroll. */
scrolling: _propTypes2.default.bool
} : void 0;
exports.default = DropdownMenu;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = undefined;
var _Dropdown = require('./Dropdown');
var _Dropdown2 = _interopRequireDefault(_Dropdown);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = _Dropdown2.default;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 | 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 10 1 1 1 1 1 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
var _createClass2 = require('babel-runtime/helpers/createClass');
var _createClass3 = _interopRequireDefault(_createClass2);
var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
var _inherits2 = require('babel-runtime/helpers/inherits');
var _inherits3 = _interopRequireDefault(_inherits2);
var _isNil2 = require('lodash/isNil');
var _isNil3 = _interopRequireDefault(_isNil2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
var _Icon = require('../../elements/Icon');
var _Icon2 = _interopRequireDefault(_Icon);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* An embed displays content from other websites like YouTube videos or Google Maps.
*/
var Embed = function (_Component) {
(0, _inherits3.default)(Embed, _Component);
function Embed() {
var _ref;
var _temp, _this, _ret;
(0, _classCallCheck3.default)(this, Embed);
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return _ret = (_temp = (_this = (0, _possibleConstructorReturn3.default)(this, (_ref = Embed.__proto__ || Object.getPrototypeOf(Embed)).call.apply(_ref, [this].concat(args))), _this), _this.state = {}, _this.handleClick = function (e) {
var onClick = _this.props.onClick;
var active = _this.state.active;
if (onClick) onClick(e, (0, _extends3.default)({}, _this.props, { active: true }));
if (!active) _this.trySetState({ active: true });
}, _temp), (0, _possibleConstructorReturn3.default)(_this, _ret);
}
(0, _createClass3.default)(Embed, [{
key: 'getSrc',
value: function getSrc() {
var _props = this.props,
_props$autoplay = _props.autoplay,
autoplay = _props$autoplay === undefined ? true : _props$autoplay,
_props$brandedUI = _props.brandedUI,
brandedUI = _props$brandedUI === undefined ? false : _props$brandedUI,
_props$color = _props.color,
color = _props$color === undefined ? '#444444' : _props$color,
_props$hd = _props.hd,
hd = _props$hd === undefined ? true : _props$hd,
id = _props.id,
source = _props.source,
url = _props.url;
if (source === 'youtube') {
return ['//www.youtube.com/embed/' + id, '?autohide=true', '&autoplay=' + autoplay, '&color=' + encodeURIComponent(color), '&hq=' + hd, '&jsapi=false', '&modestbranding=' + brandedUI].join('');
}
if (source === 'vimeo') {
return ['//player.vimeo.com/video/' + id, '?api=false', '&autoplay=' + autoplay, '&byline=false', '&color=' + encodeURIComponent(color), '&portrait=false', '&title=false'].join('');
}
return url;
}
}, {
key: 'render',
value: function render() {
var _props2 = this.props,
aspectRatio = _props2.aspectRatio,
className = _props2.className,
icon = _props2.icon,
placeholder = _props2.placeholder;
var active = this.state.active;
var classes = (0, _classnames2.default)('ui', aspectRatio, (0, _lib.useKeyOnly)(active, 'active'), 'embed', className);
var rest = (0, _lib.getUnhandledProps)(Embed, this.props);
var ElementType = (0, _lib.getElementType)(Embed, this.props);
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes, onClick: this.handleClick }),
_Icon2.default.create(icon),
placeholder && _react2.default.createElement('img', { className: 'placeholder', src: placeholder }),
this.renderEmbed()
);
}
}, {
key: 'renderEmbed',
value: function renderEmbed() {
var _props3 = this.props,
children = _props3.children,
source = _props3.source;
var active = this.state.active;
if (!active) return null;
if (!(0, _isNil3.default)(children)) return _react2.default.createElement(
'div',
{ className: 'embed' },
children
);
return _react2.default.createElement(
'div',
{ className: 'embed' },
_react2.default.createElement('iframe', {
title: 'Embedded content from ' + source + '.',
allowFullScreen: '',
frameBorder: '0',
height: '100%',
scrolling: 'no',
src: this.getSrc(),
width: '100%'
})
);
}
}]);
return Embed;
}(_lib.AutoControlledComponent);
Embed.autoControlledProps = ['active'];
Embed.defaultProps = {
icon: 'video play'
};
Embed._meta = {
name: 'Embed',
type: _lib.META.TYPES.MODULE
};
exports.default = Embed;
process.env.NODE_ENV !== "production" ? Embed.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** An embed can be active. */
active: _propTypes2.default.bool,
/** An embed can specify an alternative aspect ratio. */
aspectRatio: _propTypes2.default.oneOf(['4:3', '16:9', '21:9']),
/** Setting to true or false will force autoplay. */
autoplay: _lib.customPropTypes.every([_lib.customPropTypes.demand(['source']), _propTypes2.default.bool]),
/** Whether to show networks branded UI like title cards, or after video calls to action. */
brandedUI: _lib.customPropTypes.every([_lib.customPropTypes.demand(['source']), _propTypes2.default.bool]),
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string,
/** Specifies a default chrome color with Vimeo or YouTube. */
color: _lib.customPropTypes.every([_lib.customPropTypes.demand(['source']), _propTypes2.default.string]),
/** Initial value of active. */
defaultActive: _propTypes2.default.bool,
/** Whether to show networks branded UI like title cards, or after video calls to action. */
hd: _lib.customPropTypes.every([_lib.customPropTypes.demand(['source']), _propTypes2.default.bool]),
/** Specifies an icon to use with placeholder content. */
icon: _lib.customPropTypes.itemShorthand,
/** Specifies an id for source. */
id: _lib.customPropTypes.every([_lib.customPropTypes.demand(['source']), _propTypes2.default.string]),
/**
* Сalled on click.
*
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {object} data - All props and proposed value.
*/
onClick: _propTypes2.default.func,
/** A placeholder image for embed. */
placeholder: _propTypes2.default.string,
/** Specifies a source to use. */
source: _lib.customPropTypes.every([_lib.customPropTypes.disallow(['sourceUrl']), _propTypes2.default.oneOf(['youtube', 'vimeo'])]),
/** Specifies a url to use for embed. */
url: _lib.customPropTypes.every([_lib.customPropTypes.disallow(['source']), _propTypes2.default.string])
} : void 0;
Embed.handledProps = ['active', 'as', 'aspectRatio', 'autoplay', 'brandedUI', 'children', 'className', 'color', 'defaultActive', 'hd', 'icon', 'id', 'onClick', 'placeholder', 'source', 'url'];
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = undefined;
var _Embed = require('./Embed');
var _Embed2 = _interopRequireDefault(_Embed);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = _Embed2.default;
|
| File | Statements | Branches | Functions | Lines | |||||
|---|---|---|---|---|---|---|---|---|---|
| Modal.js | 41.86% | (54 / 129) | 11.9% | (5 / 42) | 14.29% | (2 / 14) | 43.44% | (53 / 122) | |
| ModalActions.js | 77.27% | (17 / 22) | 83.33% | (5 / 6) | 50% | (1 / 2) | 76.19% | (16 / 21) | |
| ModalContent.js | 76.92% | (20 / 26) | 62.5% | (5 / 8) | 33.33% | (1 / 3) | 76% | (19 / 25) | |
| ModalDescription.js | 77.27% | (17 / 22) | 83.33% | (5 / 6) | 50% | (1 / 2) | 76.19% | (16 / 21) | |
| ModalHeader.js | 76.92% | (20 / 26) | 62.5% | (5 / 8) | 33.33% | (1 / 3) | 76% | (19 / 25) | |
| index.js | 100% | (7 / 7) | 75% | (3 / 4) | 100% | (1 / 1) | 100% | (6 / 6) |
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 | 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 17 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
var _createClass2 = require('babel-runtime/helpers/createClass');
var _createClass3 = _interopRequireDefault(_createClass2);
var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
var _inherits2 = require('babel-runtime/helpers/inherits');
var _inherits3 = _interopRequireDefault(_inherits2);
var _pick2 = require('lodash/pick');
var _pick3 = _interopRequireDefault(_pick2);
var _omit2 = require('lodash/omit');
var _omit3 = _interopRequireDefault(_omit2);
var _invoke2 = require('lodash/invoke');
var _invoke3 = _interopRequireDefault(_invoke2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
var _Icon = require('../../elements/Icon');
var _Icon2 = _interopRequireDefault(_Icon);
var _Portal = require('../../addons/Portal');
var _Portal2 = _interopRequireDefault(_Portal);
var _ModalHeader = require('./ModalHeader');
var _ModalHeader2 = _interopRequireDefault(_ModalHeader);
var _ModalContent = require('./ModalContent');
var _ModalContent2 = _interopRequireDefault(_ModalContent);
var _ModalActions = require('./ModalActions');
var _ModalActions2 = _interopRequireDefault(_ModalActions);
var _ModalDescription = require('./ModalDescription');
var _ModalDescription2 = _interopRequireDefault(_ModalDescription);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var debug = (0, _lib.makeDebugger)('modal');
/**
* A modal displays content that temporarily blocks interactions with the main view of a site.
* @see Confirm
* @see Portal
*/
var Modal = function (_Component) {
(0, _inherits3.default)(Modal, _Component);
function Modal() {
var _ref;
var _temp, _this, _ret;
(0, _classCallCheck3.default)(this, Modal);
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return _ret = (_temp = (_this = (0, _possibleConstructorReturn3.default)(this, (_ref = Modal.__proto__ || Object.getPrototypeOf(Modal)).call.apply(_ref, [this].concat(args))), _this), _this.state = {}, _this.getMountNode = function () {
return _lib.isBrowser ? _this.props.mountNode || document.body : null;
}, _this.handleClose = function (e) {
debug('close()');
var onClose = _this.props.onClose;
if (onClose) onClose(e, _this.props);
_this.trySetState({ open: false });
}, _this.handleIconOverrides = function (predefinedProps) {
return {
onClick: function onClick(e) {
(0, _invoke3.default)(predefinedProps, 'onClick', e);
_this.handleClose(e);
}
};
}, _this.handleOpen = function (e) {
debug('open()');
var onOpen = _this.props.onOpen;
if (onOpen) onOpen(e, _this.props);
_this.trySetState({ open: true });
}, _this.handlePortalMount = function (e) {
debug('handlePortalMount()');
var dimmer = _this.props.dimmer;
var mountNode = _this.getMountNode();
if (dimmer) {
debug('adding dimmer');
mountNode.classList.add('dimmable', 'dimmed');
if (dimmer === 'blurring') {
debug('adding blurred dimmer');
mountNode.classList.add('blurring');
}
}
_this.setPosition();
var onMount = _this.props.onMount;
if (onMount) onMount(e, _this.props);
}, _this.handlePortalUnmount = function (e) {
debug('handlePortalUnmount()');
// Always remove all dimmer classes.
// If the dimmer value changes while the modal is open, then removing its
// current value could leave cruft classes previously added.
var mountNode = _this.getMountNode();
mountNode.classList.remove('blurring', 'dimmable', 'dimmed', 'scrollable');
cancelAnimationFrame(_this.animationRequestId);
var onUnmount = _this.props.onUnmount;
if (onUnmount) onUnmount(e, _this.props);
}, _this.handleRef = function (c) {
return _this.ref = c;
}, _this.setPosition = function () {
if (_this.ref) {
var mountNode = _this.getMountNode();
var _this$ref$getBounding = _this.ref.getBoundingClientRect(),
height = _this$ref$getBounding.height;
var marginTop = -Math.round(height / 2);
var scrolling = height >= window.innerHeight;
var newState = {};
if (_this.state.marginTop !== marginTop) {
newState.marginTop = marginTop;
}
if (_this.state.scrolling !== scrolling) {
newState.scrolling = scrolling;
if (scrolling) {
mountNode.classList.add('scrolling');
} else {
mountNode.classList.remove('scrolling');
}
}
if (Object.keys(newState).length > 0) _this.setState(newState);
}
_this.animationRequestId = requestAnimationFrame(_this.setPosition);
}, _temp), (0, _possibleConstructorReturn3.default)(_this, _ret);
}
(0, _createClass3.default)(Modal, [{
key: 'componentWillUnmount',
value: function componentWillUnmount() {
debug('componentWillUnmount()');
this.handlePortalUnmount();
}
// Do not access document when server side rendering
}, {
key: 'render',
value: function render() {
var open = this.state.open;
var _props = this.props,
basic = _props.basic,
children = _props.children,
className = _props.className,
closeIcon = _props.closeIcon,
closeOnDimmerClick = _props.closeOnDimmerClick,
closeOnDocumentClick = _props.closeOnDocumentClick,
dimmer = _props.dimmer,
size = _props.size,
style = _props.style;
var mountNode = this.getMountNode();
// Short circuit when server side rendering
if (!_lib.isBrowser) return null;
var _state = this.state,
marginTop = _state.marginTop,
scrolling = _state.scrolling;
var classes = (0, _classnames2.default)('ui', size, (0, _lib.useKeyOnly)(basic, 'basic'), (0, _lib.useKeyOnly)(scrolling, 'scrolling'), 'modal transition visible active', className);
var unhandled = (0, _lib.getUnhandledProps)(Modal, this.props);
var portalPropNames = _Portal2.default.handledProps;
var rest = (0, _omit3.default)(unhandled, portalPropNames);
var portalProps = (0, _pick3.default)(unhandled, portalPropNames);
var ElementType = (0, _lib.getElementType)(Modal, this.props);
var closeIconName = closeIcon === true ? 'close' : closeIcon;
var modalJSX = _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes, style: (0, _extends3.default)({ marginTop: marginTop }, style), ref: this.handleRef }),
_Icon2.default.create(closeIconName, { overrideProps: this.handleIconOverrides }),
children
);
// wrap dimmer modals
var dimmerClasses = !dimmer ? null : (0, _classnames2.default)('ui', dimmer === 'inverted' && 'inverted', 'page modals dimmer transition visible active');
// Heads up!
//
// The SUI CSS selector to prevent the modal itself from blurring requires an immediate .dimmer child:
// .blurring.dimmed.dimmable>:not(.dimmer) { ... }
//
// The .blurring.dimmed.dimmable is the body, so that all body content inside is blurred.
// We need the immediate child to be the dimmer to :not() blur the modal itself!
// Otherwise, the portal div is also blurred, blurring the modal.
//
// We cannot them wrap the modalJSX in an actual <Dimmer /> instead, we apply the dimmer classes to the <Portal />.
return _react2.default.createElement(
_Portal2.default,
(0, _extends3.default)({
closeOnRootNodeClick: closeOnDimmerClick,
closeOnDocumentClick: closeOnDocumentClick
}, portalProps, {
className: dimmerClasses,
mountNode: mountNode,
onClose: this.handleClose,
onMount: this.handlePortalMount,
onOpen: this.handleOpen,
onUnmount: this.handlePortalUnmount,
open: open
}),
modalJSX
);
}
}]);
return Modal;
}(_lib.AutoControlledComponent);
Modal.defaultProps = {
dimmer: true,
closeOnDimmerClick: true,
closeOnDocumentClick: false
};
Modal.autoControlledProps = ['open'];
Modal._meta = {
name: 'Modal',
type: _lib.META.TYPES.MODULE
};
Modal.Header = _ModalHeader2.default;
Modal.Content = _ModalContent2.default;
Modal.Description = _ModalDescription2.default;
Modal.Actions = _ModalActions2.default;
process.env.NODE_ENV !== "production" ? Modal.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** A modal can reduce its complexity */
basic: _propTypes2.default.bool,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string,
/** Icon. */
closeIcon: _propTypes2.default.oneOfType([_propTypes2.default.node, _propTypes2.default.object, _propTypes2.default.bool]),
/** Whether or not the Modal should close when the dimmer is clicked. */
closeOnDimmerClick: _propTypes2.default.bool,
/** Whether or not the Modal should close when the document is clicked. */
closeOnDocumentClick: _propTypes2.default.bool,
/** Initial value of open. */
defaultOpen: _propTypes2.default.bool,
/** A modal can appear in a dimmer. */
dimmer: _propTypes2.default.oneOfType([_propTypes2.default.bool, _propTypes2.default.oneOf(['inverted', 'blurring'])]),
/** The node where the modal should mount. Defaults to document.body. */
mountNode: _propTypes2.default.any,
/**
* Called when a close event happens.
*
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {object} data - All props.
*/
onClose: _propTypes2.default.func,
/**
* Called when the portal is mounted on the DOM.
*
* @param {null}
* @param {object} data - All props.
*/
onMount: _propTypes2.default.func,
/**
* Called when an open event happens.
*
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {object} data - All props.
*/
onOpen: _propTypes2.default.func,
/**
* Called when the portal is unmounted from the DOM.
*
* @param {null}
* @param {object} data - All props.
*/
onUnmount: _propTypes2.default.func,
/** Controls whether or not the Modal is displayed. */
open: _propTypes2.default.bool,
/** A modal can vary in size */
size: _propTypes2.default.oneOf(['fullscreen', 'large', 'small']),
/** Custom styles. */
style: _propTypes2.default.object
} : void 0;
Modal.handledProps = ['as', 'basic', 'children', 'className', 'closeIcon', 'closeOnDimmerClick', 'closeOnDocumentClick', 'defaultOpen', 'dimmer', 'mountNode', 'onClose', 'onMount', 'onOpen', 'onUnmount', 'open', 'size', 'style'];
exports.default = Modal;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | 1 1 1 1 1 1 1 1 1 1 4 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* A modal can contain a row of actions.
*/
function ModalActions(props) {
var children = props.children,
className = props.className;
var classes = (0, _classnames2.default)('actions', className);
var rest = (0, _lib.getUnhandledProps)(ModalActions, props);
var ElementType = (0, _lib.getElementType)(ModalActions, props);
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
children
);
}
ModalActions.handledProps = ['as', 'children', 'className'];
ModalActions._meta = {
name: 'ModalActions',
type: _lib.META.TYPES.MODULE,
parent: 'Modal'
};
process.env.NODE_ENV !== "production" ? ModalActions.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string
} : void 0;
exports.default = ModalActions;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 | 1 1 1 1 1 1 1 1 1 1 1 1 5 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _isNil2 = require('lodash/isNil');
var _isNil3 = _interopRequireDefault(_isNil2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* A modal can contain content.
*/
function ModalContent(props) {
var children = props.children,
className = props.className,
content = props.content,
image = props.image;
var classes = (0, _classnames2.default)(className, (0, _lib.useKeyOnly)(image, 'image'), 'content');
var rest = (0, _lib.getUnhandledProps)(ModalContent, props);
var ElementType = (0, _lib.getElementType)(ModalContent, props);
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
(0, _isNil3.default)(children) ? content : children
);
}
ModalContent.handledProps = ['as', 'children', 'className', 'content', 'image'];
ModalContent._meta = {
name: 'ModalContent',
type: _lib.META.TYPES.MODULE,
parent: 'Modal'
};
process.env.NODE_ENV !== "production" ? ModalContent.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string,
/** Shorthand for primary content. */
content: _lib.customPropTypes.contentShorthand,
/** A modal can contain image content. */
image: _propTypes2.default.bool
} : void 0;
ModalContent.create = (0, _lib.createShorthandFactory)(ModalContent, function (content) {
return { content: content };
});
exports.default = ModalContent;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | 1 1 1 1 1 1 1 1 1 1 4 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* A modal can have a header.
*/
function ModalDescription(props) {
var children = props.children,
className = props.className;
var classes = (0, _classnames2.default)('description', className);
var rest = (0, _lib.getUnhandledProps)(ModalDescription, props);
var ElementType = (0, _lib.getElementType)(ModalDescription, props);
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
children
);
}
ModalDescription.handledProps = ['as', 'children', 'className'];
ModalDescription._meta = {
name: 'ModalDescription',
type: _lib.META.TYPES.MODULE,
parent: 'Modal'
};
process.env.NODE_ENV !== "production" ? ModalDescription.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string
} : void 0;
exports.default = ModalDescription;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | 1 1 1 1 1 1 1 1 1 1 1 1 5 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _isNil2 = require('lodash/isNil');
var _isNil3 = _interopRequireDefault(_isNil2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* A modal can have a header.
*/
function ModalHeader(props) {
var children = props.children,
className = props.className,
content = props.content;
var classes = (0, _classnames2.default)(className, 'header');
var rest = (0, _lib.getUnhandledProps)(ModalHeader, props);
var ElementType = (0, _lib.getElementType)(ModalHeader, props);
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
(0, _isNil3.default)(children) ? content : children
);
}
ModalHeader.handledProps = ['as', 'children', 'className', 'content'];
ModalHeader._meta = {
name: 'ModalHeader',
type: _lib.META.TYPES.MODULE,
parent: 'Modal'
};
process.env.NODE_ENV !== "production" ? ModalHeader.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string,
/** Shorthand for primary content. */
content: _lib.customPropTypes.contentShorthand
} : void 0;
ModalHeader.create = (0, _lib.createShorthandFactory)(ModalHeader, function (content) {
return { content: content };
});
exports.default = ModalHeader;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = undefined;
var _Modal = require('./Modal');
var _Modal2 = _interopRequireDefault(_Modal);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = _Modal2.default;
|
| File | Statements | Branches | Functions | Lines | |||||
|---|---|---|---|---|---|---|---|---|---|
| Popup.js | 31.32% | (57 / 182) | 7.14% | (5 / 70) | 12.5% | (2 / 16) | 32.94% | (56 / 170) | |
| PopupContent.js | 75% | (18 / 24) | 83.33% | (5 / 6) | 33.33% | (1 / 3) | 73.91% | (17 / 23) | |
| PopupHeader.js | 75% | (18 / 24) | 83.33% | (5 / 6) | 33.33% | (1 / 3) | 73.91% | (17 / 23) | |
| index.js | 100% | (7 / 7) | 75% | (3 / 4) | 100% | (1 / 1) | 100% | (6 / 6) |
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 | 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 19 1 1 1 1 1 1 1 1 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.POSITIONS = undefined;
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
var _createClass2 = require('babel-runtime/helpers/createClass');
var _createClass3 = _interopRequireDefault(_createClass2);
var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
var _inherits2 = require('babel-runtime/helpers/inherits');
var _inherits3 = _interopRequireDefault(_inherits2);
var _isNil2 = require('lodash/isNil');
var _isNil3 = _interopRequireDefault(_isNil2);
var _pick2 = require('lodash/pick');
var _pick3 = _interopRequireDefault(_pick2);
var _omit2 = require('lodash/omit');
var _omit3 = _interopRequireDefault(_omit2);
var _assign2 = require('lodash/assign');
var _assign3 = _interopRequireDefault(_assign2);
var _mapValues2 = require('lodash/mapValues');
var _mapValues3 = _interopRequireDefault(_mapValues2);
var _isNumber2 = require('lodash/isNumber');
var _isNumber3 = _interopRequireDefault(_isNumber2);
var _includes2 = require('lodash/includes');
var _includes3 = _interopRequireDefault(_includes2);
var _without2 = require('lodash/without');
var _without3 = _interopRequireDefault(_without2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
var _Portal = require('../../addons/Portal');
var _Portal2 = _interopRequireDefault(_Portal);
var _PopupContent = require('./PopupContent');
var _PopupContent2 = _interopRequireDefault(_PopupContent);
var _PopupHeader = require('./PopupHeader');
var _PopupHeader2 = _interopRequireDefault(_PopupHeader);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var debug = (0, _lib.makeDebugger)('popup');
var POSITIONS = exports.POSITIONS = ['top left', 'top right', 'bottom right', 'bottom left', 'right center', 'left center', 'top center', 'bottom center'];
/**
* A Popup displays additional information on top of a page.
*/
var Popup = function (_Component) {
(0, _inherits3.default)(Popup, _Component);
function Popup() {
var _ref;
var _temp, _this, _ret;
(0, _classCallCheck3.default)(this, Popup);
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return _ret = (_temp = (_this = (0, _possibleConstructorReturn3.default)(this, (_ref = Popup.__proto__ || Object.getPrototypeOf(Popup)).call.apply(_ref, [this].concat(args))), _this), _this.state = {}, _this.hideOnScroll = function (e) {
_this.setState({ closed: true });
window.removeEventListener('scroll', _this.hideOnScroll);
setTimeout(function () {
return _this.setState({ closed: false });
}, 50);
}, _this.handleClose = function (e) {
debug('handleClose()');
var onClose = _this.props.onClose;
if (onClose) onClose(e, _this.props);
}, _this.handleOpen = function (e) {
debug('handleOpen()');
_this.coords = e.currentTarget.getBoundingClientRect();
var onOpen = _this.props.onOpen;
if (onOpen) onOpen(e, _this.props);
}, _this.handlePortalMount = function (e) {
debug('handlePortalMount()');
if (_this.props.hideOnScroll) {
window.addEventListener('scroll', _this.hideOnScroll);
}
var onMount = _this.props.onMount;
if (onMount) onMount(e, _this.props);
}, _this.handlePortalUnmount = function (e) {
debug('handlePortalUnmount()');
var onUnmount = _this.props.onUnmount;
if (onUnmount) onUnmount(e, _this.props);
}, _this.handlePopupRef = function (popupRef) {
debug('popupMounted()');
_this.popupCoords = popupRef ? popupRef.getBoundingClientRect() : null;
_this.setPopupStyle();
}, _temp), (0, _possibleConstructorReturn3.default)(_this, _ret);
}
(0, _createClass3.default)(Popup, [{
key: 'computePopupStyle',
value: function computePopupStyle(positions) {
var style = { position: 'absolute' };
// Do not access window/document when server side rendering
if (!_lib.isBrowser) return style;
var offset = this.props.offset;
var _window = window,
pageYOffset = _window.pageYOffset,
pageXOffset = _window.pageXOffset;
var _document$documentEle = document.documentElement,
clientWidth = _document$documentEle.clientWidth,
clientHeight = _document$documentEle.clientHeight;
if ((0, _includes3.default)(positions, 'right')) {
style.right = Math.round(clientWidth - (this.coords.right + pageXOffset));
style.left = 'auto';
} else if ((0, _includes3.default)(positions, 'left')) {
style.left = Math.round(this.coords.left + pageXOffset);
style.right = 'auto';
} else {
// if not left nor right, we are horizontally centering the element
var xOffset = (this.coords.width - this.popupCoords.width) / 2;
style.left = Math.round(this.coords.left + xOffset + pageXOffset);
style.right = 'auto';
}
if ((0, _includes3.default)(positions, 'top')) {
style.bottom = Math.round(clientHeight - (this.coords.top + pageYOffset));
style.top = 'auto';
} else if ((0, _includes3.default)(positions, 'bottom')) {
style.top = Math.round(this.coords.bottom + pageYOffset);
style.bottom = 'auto';
} else {
// if not top nor bottom, we are vertically centering the element
var yOffset = (this.coords.height + this.popupCoords.height) / 2;
style.top = Math.round(this.coords.bottom + pageYOffset - yOffset);
style.bottom = 'auto';
var _xOffset = this.popupCoords.width + 8;
if ((0, _includes3.default)(positions, 'right')) {
style.right -= _xOffset;
} else {
style.left -= _xOffset;
}
}
if (offset) {
if ((0, _isNumber3.default)(style.right)) {
style.right -= offset;
} else {
style.left -= offset;
}
}
return style;
}
// check if the style would display
// the popup outside of the view port
}, {
key: 'isStyleInViewport',
value: function isStyleInViewport(style) {
var _window2 = window,
pageYOffset = _window2.pageYOffset,
pageXOffset = _window2.pageXOffset;
var _document$documentEle2 = document.documentElement,
clientWidth = _document$documentEle2.clientWidth,
clientHeight = _document$documentEle2.clientHeight;
var element = {
top: style.top,
left: style.left,
width: this.popupCoords.width,
height: this.popupCoords.height
};
if ((0, _isNumber3.default)(style.right)) {
element.left = clientWidth - style.right - element.width;
}
if ((0, _isNumber3.default)(style.bottom)) {
element.top = clientHeight - style.bottom - element.height;
}
// hidden on top
if (element.top < pageYOffset) return false;
// hidden on the bottom
if (element.top + element.height > pageYOffset + clientHeight) return false;
// hidden the left
if (element.left < pageXOffset) return false;
// hidden on the right
if (element.left + element.width > pageXOffset + clientWidth) return false;
return true;
}
}, {
key: 'setPopupStyle',
value: function setPopupStyle() {
if (!this.coords || !this.popupCoords) return;
var position = this.props.position;
var style = this.computePopupStyle(position);
// Lets detect if the popup is out of the viewport and adjust
// the position accordingly
var positions = (0, _without3.default)(POSITIONS, position);
for (var i = 0; !this.isStyleInViewport(style) && i < positions.length; i++) {
style = this.computePopupStyle(positions[i]);
position = positions[i];
}
// Append 'px' to every numerical values in the style
style = (0, _mapValues3.default)(style, function (value) {
return (0, _isNumber3.default)(value) ? value + 'px' : value;
});
this.setState({ style: style, position: position });
}
}, {
key: 'getPortalProps',
value: function getPortalProps() {
var portalProps = {};
var _props = this.props,
on = _props.on,
hoverable = _props.hoverable;
if (hoverable) {
portalProps.closeOnPortalMouseLeave = true;
portalProps.mouseLeaveDelay = 300;
}
if (on === 'click') {
portalProps.openOnTriggerClick = true;
portalProps.closeOnTriggerClick = true;
portalProps.closeOnDocumentClick = true;
} else if (on === 'focus') {
portalProps.openOnTriggerFocus = true;
portalProps.closeOnTriggerBlur = true;
} else if (on === 'hover') {
portalProps.openOnTriggerMouseEnter = true;
portalProps.closeOnTriggerMouseLeave = true;
// Taken from SUI: https://git.io/vPmCm
portalProps.mouseLeaveDelay = 70;
portalProps.mouseEnterDelay = 50;
}
return portalProps;
}
}, {
key: 'render',
value: function render() {
var _props2 = this.props,
basic = _props2.basic,
children = _props2.children,
className = _props2.className,
content = _props2.content,
flowing = _props2.flowing,
header = _props2.header,
inverted = _props2.inverted,
size = _props2.size,
trigger = _props2.trigger,
wide = _props2.wide;
var _state = this.state,
position = _state.position,
closed = _state.closed;
var style = (0, _assign3.default)({}, this.state.style, this.props.style);
var classes = (0, _classnames2.default)('ui', position, size, (0, _lib.useKeyOrValueAndKey)(wide, 'wide'), (0, _lib.useKeyOnly)(basic, 'basic'), (0, _lib.useKeyOnly)(flowing, 'flowing'), (0, _lib.useKeyOnly)(inverted, 'inverted'), 'popup transition visible', className);
if (closed) return trigger;
var unhandled = (0, _lib.getUnhandledProps)(Popup, this.props);
var portalPropNames = _Portal2.default.handledProps;
var rest = (0, _omit3.default)(unhandled, portalPropNames);
var portalProps = (0, _pick3.default)(unhandled, portalPropNames);
var ElementType = (0, _lib.getElementType)(Popup, this.props);
var popupJSX = _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes, style: style, ref: this.handlePopupRef }),
children,
(0, _isNil3.default)(children) && _PopupHeader2.default.create(header),
(0, _isNil3.default)(children) && _PopupContent2.default.create(content)
);
var mergedPortalProps = (0, _extends3.default)({}, this.getPortalProps(), portalProps);
debug('portal props:', mergedPortalProps);
return _react2.default.createElement(
_Portal2.default,
(0, _extends3.default)({}, mergedPortalProps, {
trigger: trigger,
onClose: this.handleClose,
onMount: this.handlePortalMount,
onOpen: this.handleOpen,
onUnmount: this.handlePortalUnmount
}),
popupJSX
);
}
}]);
return Popup;
}(_react.Component);
Popup.defaultProps = {
position: 'top left',
on: 'hover'
};
Popup._meta = {
name: 'Popup',
type: _lib.META.TYPES.MODULE
};
Popup.Content = _PopupContent2.default;
Popup.Header = _PopupHeader2.default;
exports.default = Popup;
process.env.NODE_ENV !== "production" ? Popup.propTypes = {
/** Display the popup without the pointing arrow. */
basic: _propTypes2.default.bool,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string,
/** Simple text content for the popover. */
content: _lib.customPropTypes.itemShorthand,
/** A flowing Popup has no maximum width and continues to flow to fit its content. */
flowing: _propTypes2.default.bool,
/** Takes up the entire width of its offset container. */
// TODO: implement the Popup fluid layout
// fluid: PropTypes.bool,
/** Header displayed above the content in bold. */
header: _lib.customPropTypes.itemShorthand,
/** Hide the Popup when scrolling the window. */
hideOnScroll: _propTypes2.default.bool,
/** Whether the popup should not close on hover. */
hoverable: _propTypes2.default.bool,
/** Invert the colors of the Popup. */
inverted: _propTypes2.default.bool,
/** Horizontal offset in pixels to be applied to the Popup. */
offset: _propTypes2.default.number,
/** Event triggering the popup. */
on: _propTypes2.default.oneOf(['hover', 'click', 'focus']),
/**
* Called when a close event happens.
*
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {object} data - All props.
*/
onClose: _propTypes2.default.func,
/**
* Called when the portal is mounted on the DOM.
*
* @param {null}
* @param {object} data - All props.
*/
onMount: _propTypes2.default.func,
/**
* Called when an open event happens.
*
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {object} data - All props.
*/
onOpen: _propTypes2.default.func,
/**
* Called when the portal is unmounted from the DOM.
*
* @param {null}
* @param {object} data - All props.
*/
onUnmount: _propTypes2.default.func,
/** Position for the popover. */
position: _propTypes2.default.oneOf(POSITIONS),
/** Popup size. */
size: _propTypes2.default.oneOf((0, _without3.default)(_lib.SUI.SIZES, 'medium', 'big', 'massive')),
/** Custom Popup style. */
style: _propTypes2.default.object,
/** Element to be rendered in-place where the popup is defined. */
trigger: _propTypes2.default.node,
/** Popup width. */
wide: _propTypes2.default.oneOfType([_propTypes2.default.bool, _propTypes2.default.oneOf(['very'])])
} : void 0;
Popup.handledProps = ['basic', 'children', 'className', 'content', 'flowing', 'header', 'hideOnScroll', 'hoverable', 'inverted', 'offset', 'on', 'onClose', 'onMount', 'onOpen', 'onUnmount', 'position', 'size', 'style', 'trigger', 'wide'];
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | 1 1 1 1 1 1 1 1 1 1 1 4 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
exports.default = PopupContent;
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* A PopupContent displays the content body of a Popover.
*/
function PopupContent(props) {
var children = props.children,
className = props.className;
var classes = (0, _classnames2.default)('content', className);
var rest = (0, _lib.getUnhandledProps)(PopupContent, props);
var ElementType = (0, _lib.getElementType)(PopupContent, props);
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
children
);
}
PopupContent.handledProps = ['as', 'children', 'className'];
process.env.NODE_ENV !== "production" ? PopupContent.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** The content of the Popup */
children: _propTypes2.default.node,
/** Classes to add to the Popup content className. */
className: _propTypes2.default.string
} : void 0;
PopupContent._meta = {
name: 'PopupContent',
type: _lib.META.TYPES.MODULE,
parent: 'Popup'
};
PopupContent.create = (0, _lib.createShorthandFactory)(PopupContent, function (children) {
return { children: children };
});
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 | 1 1 1 1 1 1 1 1 1 1 1 4 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
exports.default = PopupHeader;
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* A PopupHeader displays a header in a Popover.
*/
function PopupHeader(props) {
var children = props.children,
className = props.className;
var classes = (0, _classnames2.default)('header', className);
var rest = (0, _lib.getUnhandledProps)(PopupHeader, props);
var ElementType = (0, _lib.getElementType)(PopupHeader, props);
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
children
);
}
PopupHeader.handledProps = ['as', 'children', 'className'];
process.env.NODE_ENV !== "production" ? PopupHeader.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string
} : void 0;
PopupHeader._meta = {
name: 'PopupHeader',
type: _lib.META.TYPES.MODULE,
parent: 'Popup'
};
PopupHeader.create = (0, _lib.createShorthandFactory)(PopupHeader, function (children) {
return { children: children };
});
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = undefined;
var _Popup = require('./Popup');
var _Popup2 = _interopRequireDefault(_Popup);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = _Popup2.default;
|
| File | Statements | Branches | Functions | Lines | |||||
|---|---|---|---|---|---|---|---|---|---|
| Progress.js | 54.93% | (39 / 71) | 16.13% | (5 / 31) | 22.22% | (2 / 9) | 58.46% | (38 / 65) | |
| index.js | 100% | (7 / 7) | 75% | (3 / 4) | 100% | (1 / 1) | 100% | (6 / 6) |
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 | 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 13 1 1 1 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
var _createClass2 = require('babel-runtime/helpers/createClass');
var _createClass3 = _interopRequireDefault(_createClass2);
var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
var _inherits2 = require('babel-runtime/helpers/inherits');
var _inherits3 = _interopRequireDefault(_inherits2);
var _isNil2 = require('lodash/isNil');
var _isNil3 = _interopRequireDefault(_isNil2);
var _round2 = require('lodash/round');
var _round3 = _interopRequireDefault(_round2);
var _clamp2 = require('lodash/clamp');
var _clamp3 = _interopRequireDefault(_clamp2);
var _isUndefined2 = require('lodash/isUndefined');
var _isUndefined3 = _interopRequireDefault(_isUndefined2);
var _without2 = require('lodash/without');
var _without3 = _interopRequireDefault(_without2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* A progress bar shows the progression of a task.
*/
var Progress = function (_Component) {
(0, _inherits3.default)(Progress, _Component);
function Progress() {
var _ref;
var _temp, _this, _ret;
(0, _classCallCheck3.default)(this, Progress);
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return _ret = (_temp = (_this = (0, _possibleConstructorReturn3.default)(this, (_ref = Progress.__proto__ || Object.getPrototypeOf(Progress)).call.apply(_ref, [this].concat(args))), _this), _this.calculatePercent = function () {
var _this$props = _this.props,
percent = _this$props.percent,
total = _this$props.total,
value = _this$props.value;
if (!(0, _isUndefined3.default)(percent)) return percent;
if (!(0, _isUndefined3.default)(total) && !(0, _isUndefined3.default)(value)) return value / total * 100;
}, _this.getPercent = function () {
var precision = _this.props.precision;
var percent = (0, _clamp3.default)(_this.calculatePercent(), 0, 100);
if ((0, _isUndefined3.default)(precision)) return percent;
return (0, _round3.default)(percent, precision);
}, _this.isAutoSuccess = function () {
var _this$props2 = _this.props,
autoSuccess = _this$props2.autoSuccess,
percent = _this$props2.percent,
total = _this$props2.total,
value = _this$props2.value;
return autoSuccess && (percent >= 100 || value >= total);
}, _this.renderLabel = function () {
var _this$props3 = _this.props,
children = _this$props3.children,
label = _this$props3.label;
if (!(0, _isNil3.default)(children)) return _react2.default.createElement(
'div',
{ className: 'label' },
children
);
return (0, _lib.createHTMLDivision)(label, { defaultProps: { className: 'label' } });
}, _this.renderProgress = function (percent) {
var _this$props4 = _this.props,
precision = _this$props4.precision,
progress = _this$props4.progress,
total = _this$props4.total,
value = _this$props4.value;
if (!progress && (0, _isUndefined3.default)(precision)) return;
return _react2.default.createElement(
'div',
{ className: 'progress' },
progress !== 'ratio' ? percent + '%' : value + '/' + total
);
}, _temp), (0, _possibleConstructorReturn3.default)(_this, _ret);
}
(0, _createClass3.default)(Progress, [{
key: 'render',
value: function render() {
var _props = this.props,
active = _props.active,
attached = _props.attached,
className = _props.className,
color = _props.color,
disabled = _props.disabled,
error = _props.error,
indicating = _props.indicating,
inverted = _props.inverted,
size = _props.size,
success = _props.success,
warning = _props.warning;
var classes = (0, _classnames2.default)('ui', color, size, (0, _lib.useKeyOnly)(active || indicating, 'active'), (0, _lib.useKeyOnly)(disabled, 'disabled'), (0, _lib.useKeyOnly)(error, 'error'), (0, _lib.useKeyOnly)(indicating, 'indicating'), (0, _lib.useKeyOnly)(inverted, 'inverted'), (0, _lib.useKeyOnly)(success || this.isAutoSuccess(), 'success'), (0, _lib.useKeyOnly)(warning, 'warning'), (0, _lib.useValueAndKey)(attached, 'attached'), 'progress', className);
var rest = (0, _lib.getUnhandledProps)(Progress, this.props);
var ElementType = (0, _lib.getElementType)(Progress, this.props);
var percent = this.getPercent();
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
_react2.default.createElement(
'div',
{ className: 'bar', style: { width: percent + '%' } },
this.renderProgress(percent)
),
this.renderLabel()
);
}
}]);
return Progress;
}(_react.Component);
Progress._meta = {
name: 'Progress',
type: _lib.META.TYPES.MODULE
};
process.env.NODE_ENV !== "production" ? Progress.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** A progress bar can show activity. */
active: _propTypes2.default.bool,
/** A progress bar can attach to and show the progress of an element (i.e. Card or Segment). */
attached: _propTypes2.default.oneOf(['top', 'bottom']),
/** Whether success state should automatically trigger when progress completes. */
autoSuccess: _propTypes2.default.bool,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string,
/** A progress bar can have different colors. */
color: _propTypes2.default.oneOf(_lib.SUI.COLORS),
/** A progress bar be disabled. */
disabled: _propTypes2.default.bool,
/** A progress bar can show a error state. */
error: _propTypes2.default.bool,
/** An indicating progress bar visually indicates the current level of progress of a task. */
indicating: _propTypes2.default.bool,
/** A progress bar can have its colors inverted. */
inverted: _propTypes2.default.bool,
/** Can be set to either to display progress as percent or ratio. */
label: _lib.customPropTypes.itemShorthand,
/** Current percent complete. */
percent: _lib.customPropTypes.every([_lib.customPropTypes.disallow(['total', 'value']), _propTypes2.default.oneOfType([_propTypes2.default.number, _propTypes2.default.string])]),
/** Decimal point precision for calculated progress. */
precision: _propTypes2.default.number,
/** A progress bar can contain a text value indicating current progress. */
progress: _propTypes2.default.oneOfType([_propTypes2.default.bool, _propTypes2.default.oneOf(['percent', 'ratio'])]),
/** A progress bar can vary in size. */
size: _propTypes2.default.oneOf((0, _without3.default)(_lib.SUI.SIZES, 'mini', 'huge', 'massive')),
/** A progress bar can show a success state. */
success: _propTypes2.default.bool,
/**
* For use with value.
* Together, these will calculate the percent.
* Mutually excludes percent.
*/
total: _lib.customPropTypes.every([_lib.customPropTypes.demand(['value']), _lib.customPropTypes.disallow(['percent']), _propTypes2.default.oneOfType([_propTypes2.default.number, _propTypes2.default.string])]),
/**
* For use with total. Together, these will calculate the percent. Mutually excludes percent.
*/
value: _lib.customPropTypes.every([_lib.customPropTypes.demand(['total']), _lib.customPropTypes.disallow(['percent']), _propTypes2.default.oneOfType([_propTypes2.default.number, _propTypes2.default.string])]),
/** A progress bar can show a warning state. */
warning: _propTypes2.default.bool
} : void 0;
Progress.handledProps = ['active', 'as', 'attached', 'autoSuccess', 'children', 'className', 'color', 'disabled', 'error', 'indicating', 'inverted', 'label', 'percent', 'precision', 'progress', 'size', 'success', 'total', 'value', 'warning'];
exports.default = Progress;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = undefined;
var _Progress = require('./Progress');
var _Progress2 = _interopRequireDefault(_Progress);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = _Progress2.default;
|
| File | Statements | Branches | Functions | Lines | |||||
|---|---|---|---|---|---|---|---|---|---|
| Rating.js | 50% | (41 / 82) | 17.24% | (5 / 29) | 22.22% | (2 / 9) | 51.95% | (40 / 77) | |
| RatingIcon.js | 52.73% | (29 / 55) | 26.32% | (5 / 19) | 28.57% | (2 / 7) | 54.9% | (28 / 51) | |
| index.js | 100% | (7 / 7) | 75% | (3 / 4) | 100% | (1 / 1) | 100% | (6 / 6) |
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 | 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 12 1 1 1 1 1 1 1 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
var _createClass2 = require('babel-runtime/helpers/createClass');
var _createClass3 = _interopRequireDefault(_createClass2);
var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
var _inherits2 = require('babel-runtime/helpers/inherits');
var _inherits3 = _interopRequireDefault(_inherits2);
var _times2 = require('lodash/times');
var _times3 = _interopRequireDefault(_times2);
var _invoke2 = require('lodash/invoke');
var _invoke3 = _interopRequireDefault(_invoke2);
var _without2 = require('lodash/without');
var _without3 = _interopRequireDefault(_without2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
var _RatingIcon = require('./RatingIcon');
var _RatingIcon2 = _interopRequireDefault(_RatingIcon);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* A rating indicates user interest in content.
*/
var Rating = function (_Component) {
(0, _inherits3.default)(Rating, _Component);
function Rating() {
var _ref;
var _temp, _this, _ret;
(0, _classCallCheck3.default)(this, Rating);
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return _ret = (_temp = (_this = (0, _possibleConstructorReturn3.default)(this, (_ref = Rating.__proto__ || Object.getPrototypeOf(Rating)).call.apply(_ref, [this].concat(args))), _this), _initialiseProps.call(_this), _temp), (0, _possibleConstructorReturn3.default)(_this, _ret);
}
(0, _createClass3.default)(Rating, [{
key: 'render',
value: function render() {
var _this2 = this;
var _props = this.props,
className = _props.className,
disabled = _props.disabled,
icon = _props.icon,
maxRating = _props.maxRating,
size = _props.size;
var _state = this.state,
rating = _state.rating,
selectedIndex = _state.selectedIndex,
isSelecting = _state.isSelecting;
var classes = (0, _classnames2.default)('ui', icon, size, (0, _lib.useKeyOnly)(disabled, 'disabled'), (0, _lib.useKeyOnly)(isSelecting && !disabled && selectedIndex >= 0, 'selected'), 'rating', className);
var rest = (0, _lib.getUnhandledProps)(Rating, this.props);
var ElementType = (0, _lib.getElementType)(Rating, this.props);
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes, role: 'radiogroup', onMouseLeave: this.handleMouseLeave }),
(0, _times3.default)(maxRating, function (i) {
return _react2.default.createElement(_RatingIcon2.default, {
active: rating >= i + 1,
'aria-checked': rating === i + 1,
'aria-posinset': i + 1,
'aria-setsize': maxRating,
index: i,
key: i,
onClick: _this2.handleIconClick,
onMouseEnter: _this2.handleIconMouseEnter,
selected: selectedIndex >= i && isSelecting
});
})
);
}
}]);
return Rating;
}(_lib.AutoControlledComponent);
Rating.autoControlledProps = ['rating'];
Rating.defaultProps = {
clearable: 'auto',
maxRating: 1
};
Rating._meta = {
name: 'Rating',
type: _lib.META.TYPES.MODULE
};
Rating.Icon = _RatingIcon2.default;
var _initialiseProps = function _initialiseProps() {
var _this3 = this;
this.handleIconClick = function (e, _ref2) {
var index = _ref2.index;
var _props2 = _this3.props,
clearable = _props2.clearable,
disabled = _props2.disabled,
maxRating = _props2.maxRating,
onRate = _props2.onRate;
var rating = _this3.state.rating;
if (disabled) return;
// default newRating is the clicked icon
// allow toggling a binary rating
// allow clearing ratings
var newRating = index + 1;
if (clearable === 'auto' && maxRating === 1) {
newRating = +!rating;
} else if (clearable === true && newRating === rating) {
newRating = 0;
}
// set rating
_this3.trySetState({ rating: newRating }, { isSelecting: false });
if (onRate) onRate(e, (0, _extends3.default)({}, _this3.props, { rating: newRating }));
};
this.handleIconMouseEnter = function (e, _ref3) {
var index = _ref3.index;
if (_this3.props.disabled) return;
_this3.setState({ selectedIndex: index, isSelecting: true });
};
this.handleMouseLeave = function () {
for (var _len2 = arguments.length, args = Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
args[_key2] = arguments[_key2];
}
_invoke3.default.apply(undefined, [_this3.props, 'onMouseLeave'].concat(args));
if (_this3.props.disabled) return;
_this3.setState({ selectedIndex: -1, isSelecting: false });
};
};
exports.default = Rating;
process.env.NODE_ENV !== "production" ? Rating.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Additional classes. */
className: _propTypes2.default.string,
/**
* You can clear the rating by clicking on the current start rating.
* By default a rating will be only clearable if there is 1 icon.
* Setting to `true`/`false` will allow or disallow a user to clear their rating.
*/
clearable: _propTypes2.default.oneOfType([_propTypes2.default.bool, _propTypes2.default.oneOf(['auto'])]),
/** The initial rating value. */
defaultRating: _propTypes2.default.oneOfType([_propTypes2.default.number, _propTypes2.default.string]),
/** You can disable or enable interactive rating. Makes a read-only rating. */
disabled: _propTypes2.default.bool,
/** A rating can use a set of star or heart icons. */
icon: _propTypes2.default.oneOf(['star', 'heart']),
/** The total number of icons. */
maxRating: _propTypes2.default.oneOfType([_propTypes2.default.number, _propTypes2.default.string]),
/**
* Called after user selects a new rating.
*
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {object} data - All props and proposed rating.
*/
onRate: _propTypes2.default.func,
/** The current number of active icons. */
rating: _propTypes2.default.oneOfType([_propTypes2.default.number, _propTypes2.default.string]),
/** A progress bar can vary in size. */
size: _propTypes2.default.oneOf((0, _without3.default)(_lib.SUI.SIZES, 'medium', 'big'))
} : void 0;
Rating.handledProps = ['as', 'className', 'clearable', 'defaultRating', 'disabled', 'icon', 'maxRating', 'onRate', 'rating', 'size'];
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 | 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 8 1 1 1 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
var _createClass2 = require('babel-runtime/helpers/createClass');
var _createClass3 = _interopRequireDefault(_createClass2);
var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
var _inherits2 = require('babel-runtime/helpers/inherits');
var _inherits3 = _interopRequireDefault(_inherits2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* An internal icon sub-component for Rating component
*/
var RatingIcon = function (_Component) {
(0, _inherits3.default)(RatingIcon, _Component);
function RatingIcon() {
var _ref;
var _temp, _this, _ret;
(0, _classCallCheck3.default)(this, RatingIcon);
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return _ret = (_temp = (_this = (0, _possibleConstructorReturn3.default)(this, (_ref = RatingIcon.__proto__ || Object.getPrototypeOf(RatingIcon)).call.apply(_ref, [this].concat(args))), _this), _this.defaultProps = {
as: 'i'
}, _this.handleClick = function (e) {
var onClick = _this.props.onClick;
if (onClick) onClick(e, _this.props);
}, _this.handleKeyUp = function (e) {
var _this$props = _this.props,
onClick = _this$props.onClick,
onKeyUp = _this$props.onKeyUp;
if (onKeyUp) onKeyUp(e, _this.props);
if (onClick) {
switch (_lib.keyboardKey.getCode(e)) {
case _lib.keyboardKey.Enter:
case _lib.keyboardKey.Spacebar:
e.preventDefault();
onClick(e, _this.props);
break;
default:
return;
}
}
}, _this.handleMouseEnter = function (e) {
var onMouseEnter = _this.props.onMouseEnter;
if (onMouseEnter) onMouseEnter(e, _this.props);
}, _temp), (0, _possibleConstructorReturn3.default)(_this, _ret);
}
(0, _createClass3.default)(RatingIcon, [{
key: 'render',
value: function render() {
var _props = this.props,
active = _props.active,
className = _props.className,
selected = _props.selected;
var classes = (0, _classnames2.default)((0, _lib.useKeyOnly)(active, 'active'), (0, _lib.useKeyOnly)(selected, 'selected'), 'icon', className);
var rest = (0, _lib.getUnhandledProps)(RatingIcon, this.props);
var ElementType = (0, _lib.getElementType)(RatingIcon, this.props);
return _react2.default.createElement(ElementType, (0, _extends3.default)({}, rest, {
className: classes,
onClick: this.handleClick,
onKeyUp: this.handleKeyUp,
onMouseEnter: this.handleMouseEnter,
tabIndex: 0,
role: 'radio'
}));
}
}]);
return RatingIcon;
}(_react.Component);
RatingIcon._meta = {
name: 'RatingIcon',
parent: 'Rating',
type: _lib.META.TYPES.MODULE
};
exports.default = RatingIcon;
process.env.NODE_ENV !== "production" ? RatingIcon.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Indicates activity of an icon. */
active: _propTypes2.default.bool,
/** Additional classes. */
className: _propTypes2.default.string,
/** An index of icon inside Rating. */
index: _propTypes2.default.number,
/**
* Called on click.
*
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {object} data - All props.
*/
onClick: _propTypes2.default.func,
/**
* Called on keyup.
*
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {object} data - All props.
*/
onKeyUp: _propTypes2.default.func,
/**
* Called on mouseenter.
*
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {object} data - All props.
*/
onMouseEnter: _propTypes2.default.func,
/** Indicates selection of an icon. */
selected: _propTypes2.default.bool
} : void 0;
RatingIcon.handledProps = ['active', 'as', 'className', 'index', 'onClick', 'onKeyUp', 'onMouseEnter', 'selected'];
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = undefined;
var _Rating = require('./Rating');
var _Rating2 = _interopRequireDefault(_Rating);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = _Rating2.default;
|
| File | Statements | Branches | Functions | Lines | |||||
|---|---|---|---|---|---|---|---|---|---|
| Search.js | 22.26% | (65 / 292) | 4.13% | (5 / 121) | 5.26% | (2 / 38) | 23.62% | (64 / 271) | |
| SearchCategory.js | 72% | (18 / 25) | 83.33% | (5 / 6) | 33.33% | (1 / 3) | 70.83% | (17 / 24) | |
| SearchResult.js | 66.67% | (32 / 48) | 27.78% | (5 / 18) | 33.33% | (2 / 6) | 67.39% | (31 / 46) | |
| SearchResults.js | 77.27% | (17 / 22) | 83.33% | (5 / 6) | 50% | (1 / 2) | 76.19% | (16 / 21) | |
| index.js | 100% | (7 / 7) | 75% | (3 / 4) | 100% | (1 / 1) | 100% | (6 / 6) |
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 323 324 325 326 327 328 329 330 331 332 333 334 335 336 337 338 339 340 341 342 343 344 345 346 347 348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 466 467 468 469 470 471 472 473 474 475 476 477 478 479 480 481 482 483 484 485 486 487 488 489 490 491 492 493 494 495 496 497 498 499 500 501 502 503 504 505 506 507 508 509 510 511 512 513 514 515 516 517 518 519 520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 731 732 733 734 735 736 737 738 739 740 741 742 743 744 | 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 23 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _slicedToArray2 = require('babel-runtime/helpers/slicedToArray');
var _slicedToArray3 = _interopRequireDefault(_slicedToArray2);
var _objectWithoutProperties2 = require('babel-runtime/helpers/objectWithoutProperties');
var _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2);
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
var _createClass2 = require('babel-runtime/helpers/createClass');
var _createClass3 = _interopRequireDefault(_createClass2);
var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
var _get3 = require('babel-runtime/helpers/get');
var _get4 = _interopRequireDefault(_get3);
var _inherits2 = require('babel-runtime/helpers/inherits');
var _inherits3 = _interopRequireDefault(_inherits2);
var _isEmpty2 = require('lodash/isEmpty');
var _isEmpty3 = _interopRequireDefault(_isEmpty2);
var _partialRight2 = require('lodash/partialRight');
var _partialRight3 = _interopRequireDefault(_partialRight2);
var _inRange2 = require('lodash/inRange');
var _inRange3 = _interopRequireDefault(_inRange2);
var _map2 = require('lodash/map');
var _map3 = _interopRequireDefault(_map2);
var _get5 = require('lodash/get');
var _get6 = _interopRequireDefault(_get5);
var _reduce2 = require('lodash/reduce');
var _reduce3 = _interopRequireDefault(_reduce2);
var _isEqual2 = require('lodash/isEqual');
var _isEqual3 = _interopRequireDefault(_isEqual2);
var _without2 = require('lodash/without');
var _without3 = _interopRequireDefault(_without2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
var _Input = require('../../elements/Input');
var _Input2 = _interopRequireDefault(_Input);
var _SearchCategory = require('./SearchCategory');
var _SearchCategory2 = _interopRequireDefault(_SearchCategory);
var _SearchResult = require('./SearchResult');
var _SearchResult2 = _interopRequireDefault(_SearchResult);
var _SearchResults = require('./SearchResults');
var _SearchResults2 = _interopRequireDefault(_SearchResults);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
var debug = (0, _lib.makeDebugger)('search');
/**
* A search module allows a user to query for results from a selection of data
*/
var Search = function (_Component) {
(0, _inherits3.default)(Search, _Component);
function Search() {
var _ref;
var _temp, _this, _ret;
(0, _classCallCheck3.default)(this, Search);
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return _ret = (_temp = (_this = (0, _possibleConstructorReturn3.default)(this, (_ref = Search.__proto__ || Object.getPrototypeOf(Search)).call.apply(_ref, [this].concat(args))), _this), _this.handleResultSelect = function (e, result) {
debug('handleResultSelect()');
debug(result);
var onResultSelect = _this.props.onResultSelect;
if (onResultSelect) onResultSelect(e, result);
}, _this.closeOnEscape = function (e) {
if (_lib.keyboardKey.getCode(e) !== _lib.keyboardKey.Escape) return;
e.preventDefault();
_this.close();
}, _this.moveSelectionOnKeyDown = function (e) {
debug('moveSelectionOnKeyDown()');
debug(_lib.keyboardKey.getName(e));
switch (_lib.keyboardKey.getCode(e)) {
case _lib.keyboardKey.ArrowDown:
e.preventDefault();
_this.moveSelectionBy(1);
break;
case _lib.keyboardKey.ArrowUp:
e.preventDefault();
_this.moveSelectionBy(-1);
break;
default:
break;
}
}, _this.selectItemOnEnter = function (e) {
debug('selectItemOnEnter()');
debug(_lib.keyboardKey.getName(e));
if (_lib.keyboardKey.getCode(e) !== _lib.keyboardKey.Enter) return;
e.preventDefault();
var result = _this.getSelectedResult();
// prevent selecting null if there was no selected item value
if (!result) return;
// notify the onResultSelect prop that the user is trying to change value
_this.setValue(result.title);
_this.handleResultSelect(e, result);
_this.close();
}, _this.closeOnDocumentClick = function (e) {
debug('closeOnDocumentClick()');
debug(e);
_this.close();
}, _this.handleMouseDown = function (e) {
debug('handleMouseDown()');
var onMouseDown = _this.props.onMouseDown;
if (onMouseDown) onMouseDown(e, _this.props);
_this.isMouseDown = true;
// Do not access document when server side rendering
if (!_lib.isBrowser) return;
document.addEventListener('mouseup', _this.handleDocumentMouseUp);
}, _this.handleDocumentMouseUp = function () {
debug('handleDocumentMouseUp()');
_this.isMouseDown = false;
// Do not access document when server side rendering
if (!_lib.isBrowser) return;
document.removeEventListener('mouseup', _this.handleDocumentMouseUp);
}, _this.handleInputClick = function (e) {
debug('handleInputClick()', e);
// prevent closeOnDocumentClick()
e.nativeEvent.stopImmediatePropagation();
_this.tryOpen();
}, _this.handleItemClick = function (e, _ref2) {
var id = _ref2.id;
debug('handleItemClick()');
debug(id);
var result = _this.getSelectedResult(id);
// prevent closeOnDocumentClick()
e.nativeEvent.stopImmediatePropagation();
// notify the onResultSelect prop that the user is trying to change value
_this.setValue(result.title);
_this.handleResultSelect(e, result);
_this.close();
}, _this.handleFocus = function (e) {
debug('handleFocus()');
var onFocus = _this.props.onFocus;
if (onFocus) onFocus(e, _this.props);
_this.setState({ focus: true });
}, _this.handleBlur = function (e) {
debug('handleBlur()');
var onBlur = _this.props.onBlur;
if (onBlur) onBlur(e, _this.props);
_this.setState({ focus: false });
}, _this.handleSearchChange = function (e) {
debug('handleSearchChange()');
debug(e.target.value);
// prevent propagating to this.props.onChange()
e.stopPropagation();
var _this$props = _this.props,
onSearchChange = _this$props.onSearchChange,
minCharacters = _this$props.minCharacters;
var open = _this.state.open;
var newQuery = e.target.value;
if (onSearchChange) onSearchChange(e, newQuery);
// open search dropdown on search query
if (newQuery.length < minCharacters) {
_this.close();
} else if (!open) {
_this.tryOpen(newQuery);
}
_this.setValue(newQuery);
}, _this.getFlattenedResults = function () {
var _this$props2 = _this.props,
category = _this$props2.category,
results = _this$props2.results;
return !category ? results : (0, _reduce3.default)(results, function (memo, categoryData) {
return memo.concat(categoryData.results);
}, []);
}, _this.getSelectedResult = function () {
var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _this.state.selectedIndex;
var results = _this.getFlattenedResults();
return (0, _get6.default)(results, index);
}, _this.setValue = function (value) {
debug('setValue()');
debug('value', value);
var selectFirstResult = _this.props.selectFirstResult;
_this.trySetState({ value: value }, { selectedIndex: selectFirstResult ? 0 : -1 });
}, _this.moveSelectionBy = function (offset) {
debug('moveSelectionBy()');
debug('offset: ' + offset);
var selectedIndex = _this.state.selectedIndex;
var results = _this.getFlattenedResults();
var lastIndex = results.length - 1;
// next is after last, wrap to beginning
// next is before first, wrap to end
var nextIndex = selectedIndex + offset;
if (nextIndex > lastIndex) nextIndex = 0;else if (nextIndex < 0) nextIndex = lastIndex;
_this.setState({ selectedIndex: nextIndex });
_this.scrollSelectedItemIntoView();
}, _this.scrollSelectedItemIntoView = function () {
debug('scrollSelectedItemIntoView()');
// Do not access document when server side rendering
if (!_lib.isBrowser) return;
var menu = document.querySelector('.ui.search.active.visible .results.visible');
var item = menu.querySelector('.result.active');
debug('menu (results): ' + menu);
debug('item (result): ' + item);
var isOutOfUpperView = item.offsetTop < menu.scrollTop;
var isOutOfLowerView = item.offsetTop + item.clientHeight > menu.scrollTop + menu.clientHeight;
if (isOutOfUpperView) {
menu.scrollTop = item.offsetTop;
} else if (isOutOfLowerView) {
menu.scrollTop = item.offsetTop + item.clientHeight - menu.clientHeight;
}
}, _this.tryOpen = function () {
var currentValue = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _this.state.value;
debug('open()');
var minCharacters = _this.props.minCharacters;
if (currentValue.length < minCharacters) return;
_this.open();
}, _this.open = function () {
debug('open()');
_this.trySetState({ open: true });
}, _this.close = function () {
debug('close()');
_this.trySetState({ open: false });
}, _this.renderSearchInput = function (rest) {
var _this$props3 = _this.props,
icon = _this$props3.icon,
input = _this$props3.input;
var value = _this.state.value;
return _Input2.default.create(input, { defaultProps: (0, _extends3.default)({}, rest, {
icon: icon,
input: { className: 'prompt', tabIndex: '0', autoComplete: 'off' },
onBlur: _this.handleBlur,
onChange: _this.handleSearchChange,
onClick: _this.handleInputClick,
onFocus: _this.handleFocus,
value: value
}) });
}, _this.renderNoResults = function () {
var _this$props4 = _this.props,
noResultsDescription = _this$props4.noResultsDescription,
noResultsMessage = _this$props4.noResultsMessage;
return _react2.default.createElement(
'div',
{ className: 'message empty' },
_react2.default.createElement(
'div',
{ className: 'header' },
noResultsMessage
),
noResultsDescription && _react2.default.createElement(
'div',
{ className: 'description' },
noResultsDescription
)
);
}, _this.renderResult = function (_ref3, index, _array) {
var offset = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 0;
var childKey = _ref3.childKey,
result = (0, _objectWithoutProperties3.default)(_ref3, ['childKey']);
var resultRenderer = _this.props.resultRenderer;
var selectedIndex = _this.state.selectedIndex;
var offsetIndex = index + offset;
return _react2.default.createElement(_SearchResult2.default, (0, _extends3.default)({
key: childKey || result.title,
active: selectedIndex === offsetIndex,
onClick: _this.handleItemClick,
renderer: resultRenderer
}, result, {
id: offsetIndex // Used to lookup the result on item click
}));
}, _this.renderResults = function () {
var results = _this.props.results;
return (0, _map3.default)(results, _this.renderResult);
}, _this.renderCategories = function () {
var _this$props5 = _this.props,
categoryRenderer = _this$props5.categoryRenderer,
categories = _this$props5.results;
var selectedIndex = _this.state.selectedIndex;
var count = 0;
return (0, _map3.default)(categories, function (_ref4, name, index) {
var childKey = _ref4.childKey,
category = (0, _objectWithoutProperties3.default)(_ref4, ['childKey']);
var categoryProps = (0, _extends3.default)({
key: childKey || category.name,
active: (0, _inRange3.default)(selectedIndex, count, count + category.results.length),
renderer: categoryRenderer
}, category);
var renderFn = (0, _partialRight3.default)(_this.renderResult, count);
count = count + category.results.length;
return _react2.default.createElement(
_SearchCategory2.default,
categoryProps,
category.results.map(renderFn)
);
});
}, _this.renderMenuContent = function () {
var _this$props6 = _this.props,
category = _this$props6.category,
showNoResults = _this$props6.showNoResults,
results = _this$props6.results;
if ((0, _isEmpty3.default)(results)) {
return showNoResults ? _this.renderNoResults() : null;
}
return category ? _this.renderCategories() : _this.renderResults();
}, _this.renderResultsMenu = function () {
var open = _this.state.open;
var resultsClasses = open ? 'visible' : '';
var menuContent = _this.renderMenuContent();
if (!menuContent) return;
return _react2.default.createElement(
_SearchResults2.default,
{ className: resultsClasses },
menuContent
);
}, _temp), (0, _possibleConstructorReturn3.default)(_this, _ret);
}
(0, _createClass3.default)(Search, [{
key: 'componentWillMount',
value: function componentWillMount() {
if ((0, _get4.default)(Search.prototype.__proto__ || Object.getPrototypeOf(Search.prototype), 'componentWillMount', this)) (0, _get4.default)(Search.prototype.__proto__ || Object.getPrototypeOf(Search.prototype), 'componentWillMount', this).call(this);
debug('componentWillMount()');
var _state = this.state,
open = _state.open,
value = _state.value;
this.setValue(value);
if (open) this.open();
}
}, {
key: 'shouldComponentUpdate',
value: function shouldComponentUpdate(nextProps, nextState) {
return !(0, _isEqual3.default)(nextProps, this.props) || !(0, _isEqual3.default)(nextState, this.state);
}
}, {
key: 'componentWillReceiveProps',
value: function componentWillReceiveProps(nextProps) {
(0, _get4.default)(Search.prototype.__proto__ || Object.getPrototypeOf(Search.prototype), 'componentWillReceiveProps', this).call(this, nextProps);
debug('componentWillReceiveProps()');
// TODO objectDiff still runs in prod, stop it
debug('changed props:', (0, _lib.objectDiff)(nextProps, this.props));
if (!(0, _isEqual3.default)(nextProps.value, this.props.value)) {
debug('value changed, setting', nextProps.value);
this.setValue(nextProps.value);
}
}
}, {
key: 'componentDidUpdate',
value: function componentDidUpdate(prevProps, prevState) {
// eslint-disable-line complexity
debug('componentDidUpdate()');
// TODO objectDiff still runs in prod, stop it
debug('to state:', (0, _lib.objectDiff)(prevState, this.state));
// Do not access document when server side rendering
if (!_lib.isBrowser) return;
// focused / blurred
if (!prevState.focus && this.state.focus) {
debug('search focused');
if (!this.isMouseDown) {
debug('mouse is not down, opening');
this.tryOpen();
}
if (this.state.open) {
document.addEventListener('keydown', this.moveSelectionOnKeyDown);
document.addEventListener('keydown', this.selectItemOnEnter);
}
} else if (prevState.focus && !this.state.focus) {
debug('search blurred');
if (!this.isMouseDown) {
debug('mouse is not down, closing');
this.close();
}
document.removeEventListener('keydown', this.moveSelectionOnKeyDown);
document.removeEventListener('keydown', this.selectItemOnEnter);
}
// opened / closed
if (!prevState.open && this.state.open) {
debug('search opened');
this.open();
document.addEventListener('keydown', this.closeOnEscape);
document.addEventListener('keydown', this.moveSelectionOnKeyDown);
document.addEventListener('keydown', this.selectItemOnEnter);
document.addEventListener('click', this.closeOnDocumentClick);
} else if (prevState.open && !this.state.open) {
debug('search closed');
this.close();
document.removeEventListener('keydown', this.closeOnEscape);
document.removeEventListener('keydown', this.moveSelectionOnKeyDown);
document.removeEventListener('keydown', this.selectItemOnEnter);
document.removeEventListener('click', this.closeOnDocumentClick);
}
}
}, {
key: 'componentWillUnmount',
value: function componentWillUnmount() {
debug('componentWillUnmount()');
// Do not access document when server side rendering
if (!_lib.isBrowser) return;
document.removeEventListener('keydown', this.moveSelectionOnKeyDown);
document.removeEventListener('keydown', this.selectItemOnEnter);
document.removeEventListener('keydown', this.closeOnEscape);
document.removeEventListener('click', this.closeOnDocumentClick);
}
// ----------------------------------------
// Document Event Handlers
// ----------------------------------------
// ----------------------------------------
// Component Event Handlers
// ----------------------------------------
// ----------------------------------------
// Getters
// ----------------------------------------
// ----------------------------------------
// Setters
// ----------------------------------------
// ----------------------------------------
// Behavior
// ----------------------------------------
// Open if the current value is greater than the minCharacters prop
// ----------------------------------------
// Render
// ----------------------------------------
/**
* Offset is needed for determining the active item for results within a
* category. Since the index is reset to 0 for each new category, an offset
* must be passed in.
*/
}, {
key: 'render',
value: function render() {
debug('render()');
debug('props', this.props);
debug('state', this.state);
var _state2 = this.state,
searchClasses = _state2.searchClasses,
focus = _state2.focus,
open = _state2.open;
var _props = this.props,
aligned = _props.aligned,
category = _props.category,
className = _props.className,
fluid = _props.fluid,
loading = _props.loading,
size = _props.size;
// Classes
var classes = (0, _classnames2.default)('ui', open && 'active visible', size, searchClasses, (0, _lib.useKeyOnly)(category, 'category'), (0, _lib.useKeyOnly)(focus, 'focus'), (0, _lib.useKeyOnly)(fluid, 'fluid'), (0, _lib.useKeyOnly)(loading, 'loading'), (0, _lib.useValueAndKey)(aligned, 'aligned'), 'search', className);
var unhandled = (0, _lib.getUnhandledProps)(Search, this.props);
var ElementType = (0, _lib.getElementType)(Search, this.props);
var _partitionHTMLInputPr = (0, _lib.partitionHTMLInputProps)(unhandled, _lib.htmlInputAttrs),
_partitionHTMLInputPr2 = (0, _slicedToArray3.default)(_partitionHTMLInputPr, 2),
htmlInputProps = _partitionHTMLInputPr2[0],
rest = _partitionHTMLInputPr2[1];
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, {
className: classes,
onBlur: this.handleBlur,
onFocus: this.handleFocus,
onMouseDown: this.handleMouseDown
}),
this.renderSearchInput(htmlInputProps),
this.renderResultsMenu()
);
}
}]);
return Search;
}(_lib.AutoControlledComponent);
Search.defaultProps = {
icon: 'search',
input: 'text',
minCharacters: 1,
noResultsMessage: 'No results found.',
showNoResults: true
};
Search.autoControlledProps = ['open', 'value'];
Search._meta = {
name: 'Search',
type: _lib.META.TYPES.MODULE
};
Search.Category = _SearchCategory2.default;
Search.Result = _SearchResult2.default;
Search.Results = _SearchResults2.default;
exports.default = Search;
process.env.NODE_ENV !== "production" ? Search.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
// ------------------------------------
// Behavior
// ------------------------------------
/** Initial value of open. */
defaultOpen: _propTypes2.default.bool,
/** Initial value. */
defaultValue: _propTypes2.default.string,
/** Shorthand for Icon. */
icon: _propTypes2.default.oneOfType([_propTypes2.default.node, _propTypes2.default.object]),
/** Minimum characters to query for results */
minCharacters: _propTypes2.default.number,
/** Additional text for "No Results" message with less emphasis. */
noResultsDescription: _propTypes2.default.string,
/** Message to display when there are no results. */
noResultsMessage: _propTypes2.default.string,
/** Controls whether or not the results menu is displayed. */
open: _propTypes2.default.bool,
/**
* One of:
* - array of Search.Result props e.g. `{ title: '', description: '' }` or
* - object of categories e.g. `{ name: '', results: [{ title: '', description: '' }]`
*/
results: _propTypes2.default.oneOfType([_propTypes2.default.arrayOf(_propTypes2.default.shape(_SearchResult2.default.propTypes)), _propTypes2.default.object]),
/** Whether the search should automatically select the first result after searching. */
selectFirstResult: _propTypes2.default.bool,
/** Whether a "no results" message should be shown if no results are found. */
showNoResults: _propTypes2.default.bool,
/** Current value of the search input. Creates a controlled component. */
value: _propTypes2.default.string,
// ------------------------------------
// Rendering
// ------------------------------------
/**
* Renders the SearchCategory contents.
*
* @param {object} props - The SearchCategory props object.
* @returns {*} - Renderable SearchCategory contents.
*/
categoryRenderer: _propTypes2.default.func,
/**
* Renders the SearchResult contents.
*
* @param {object} props - The SearchResult props object.
* @returns {*} - Renderable SearchResult contents.
*/
resultRenderer: _propTypes2.default.func,
// ------------------------------------
// Callbacks
// ------------------------------------
/**
* Called on blur.
*
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {object} data - All props.
*/
onBlur: _propTypes2.default.func,
/**
* Called on focus.
*
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {object} data - All props.
*/
onFocus: _propTypes2.default.func,
/**
* Called on mousedown.
*
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {object} data - All props.
*/
onMouseDown: _propTypes2.default.func,
/**
* Called when a result is selected.
*
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {object} data - All props.
*/
onResultSelect: _propTypes2.default.func,
/**
* Called on search input change.
*
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {string} value - Current value of search input.
*/
onSearchChange: _propTypes2.default.func,
// ------------------------------------
// Style
// ------------------------------------
/** A search can have its results aligned to its left or right container edge. */
aligned: _propTypes2.default.string,
/** A search can display results from remote content ordered by categories. */
category: _propTypes2.default.bool,
/** Additional classes. */
className: _propTypes2.default.string,
/** A search can have its results take up the width of its container. */
fluid: _propTypes2.default.bool,
/** A search input can take up the width of its container. */
input: _lib.customPropTypes.itemShorthand,
/** A search can show a loading indicator. */
loading: _propTypes2.default.bool,
/** A search can have different sizes. */
size: _propTypes2.default.oneOf((0, _without3.default)(_lib.SUI.SIZES, 'medium'))
} : void 0;
Search.handledProps = ['aligned', 'as', 'category', 'categoryRenderer', 'className', 'defaultOpen', 'defaultValue', 'fluid', 'icon', 'input', 'loading', 'minCharacters', 'noResultsDescription', 'noResultsMessage', 'onBlur', 'onFocus', 'onMouseDown', 'onResultSelect', 'onSearchChange', 'open', 'resultRenderer', 'results', 'selectFirstResult', 'showNoResults', 'size', 'value'];
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | 1 1 1 1 1 1 1 1 1 1 4 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function SearchCategory(props) {
var active = props.active,
children = props.children,
className = props.className,
renderer = props.renderer;
var classes = (0, _classnames2.default)((0, _lib.useKeyOnly)(active, 'active'), 'category', className);
var rest = (0, _lib.getUnhandledProps)(SearchCategory, props);
var ElementType = (0, _lib.getElementType)(SearchCategory, props);
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
_react2.default.createElement(
'div',
{ className: 'name' },
renderer(props)
),
children
);
}
SearchCategory.handledProps = ['active', 'as', 'children', 'className', 'name', 'renderer', 'results'];
SearchCategory._meta = {
name: 'SearchCategory',
parent: 'Search',
type: _lib.META.TYPES.MODULE
};
SearchCategory.defaultProps = {
renderer: function renderer(_ref) {
var name = _ref.name;
return name;
}
};
process.env.NODE_ENV !== "production" ? SearchCategory.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** The item currently selected by keyboard shortcut. */
active: _propTypes2.default.bool,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string,
/** Display name. */
name: _propTypes2.default.string,
/**
* Renders the category contents.
*
* @param {object} props - The SearchCategory props object.
* @returns {*} - Renderable category contents.
*/
renderer: _propTypes2.default.func,
/** Array of Search.Result props. */
results: _propTypes2.default.array
} : void 0;
exports.default = SearchCategory;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 | 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 8 1 1 1 1 1 1 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
var _createClass2 = require('babel-runtime/helpers/createClass');
var _createClass3 = _interopRequireDefault(_createClass2);
var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
var _inherits2 = require('babel-runtime/helpers/inherits');
var _inherits3 = _interopRequireDefault(_inherits2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
// Note: You technically only need the 'content' wrapper when there's an
// image. However, optionally wrapping it makes this function a lot more
// complicated and harder to read. Since always wrapping it doesn't affect
// the style in any way let's just do that.
//
// Note: To avoid requiring a wrapping div, we return an array here so to
// prevent rendering issues each node needs a unique key.
var defaultRenderer = function defaultRenderer(_ref) {
var image = _ref.image,
price = _ref.price,
title = _ref.title,
description = _ref.description;
return [image && _react2.default.createElement(
'div',
{ key: 'image', className: 'image' },
(0, _lib.createHTMLImage)(image)
), _react2.default.createElement(
'div',
{ key: 'content', className: 'content' },
price && _react2.default.createElement(
'div',
{ className: 'price' },
price
),
title && _react2.default.createElement(
'div',
{ className: 'title' },
title
),
description && _react2.default.createElement(
'div',
{ className: 'description' },
description
)
)];
};
defaultRenderer.handledProps = [];
var SearchResult = function (_Component) {
(0, _inherits3.default)(SearchResult, _Component);
function SearchResult() {
var _ref2;
var _temp, _this, _ret;
(0, _classCallCheck3.default)(this, SearchResult);
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return _ret = (_temp = (_this = (0, _possibleConstructorReturn3.default)(this, (_ref2 = SearchResult.__proto__ || Object.getPrototypeOf(SearchResult)).call.apply(_ref2, [this].concat(args))), _this), _this.handleClick = function (e) {
var onClick = _this.props.onClick;
if (onClick) onClick(e, _this.props);
}, _temp), (0, _possibleConstructorReturn3.default)(_this, _ret);
}
(0, _createClass3.default)(SearchResult, [{
key: 'render',
value: function render() {
var _props = this.props,
active = _props.active,
className = _props.className,
renderer = _props.renderer;
var classes = (0, _classnames2.default)((0, _lib.useKeyOnly)(active, 'active'), 'result', className);
var rest = (0, _lib.getUnhandledProps)(SearchResult, this.props);
var ElementType = (0, _lib.getElementType)(SearchResult, this.props);
// Note: You technically only need the 'content' wrapper when there's an
// image. However, optionally wrapping it makes this function a lot more
// complicated and harder to read. Since always wrapping it doesn't affect
// the style in any way let's just do that.
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes, onClick: this.handleClick }),
renderer(this.props)
);
}
}]);
return SearchResult;
}(_react.Component);
SearchResult.defaultProps = {
renderer: defaultRenderer
};
SearchResult._meta = {
name: 'SearchResult',
parent: 'Search',
type: _lib.META.TYPES.MODULE
};
exports.default = SearchResult;
process.env.NODE_ENV !== "production" ? SearchResult.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** The item currently selected by keyboard shortcut. */
active: _propTypes2.default.bool,
/** Additional classes. */
className: _propTypes2.default.string,
/** Additional text with less emphasis. */
description: _propTypes2.default.string,
/** A unique identifier. */
id: _propTypes2.default.number,
/** Add an image to the item. */
image: _propTypes2.default.string,
/**
* Called on click.
*
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {object} data - All props.
*/
onClick: _propTypes2.default.func,
/** Customized text for price. */
price: _propTypes2.default.string,
/**
* Renders the result contents.
*
* @param {object} props - The SearchResult props object.
* @returns {*} - Renderable result contents.
*/
renderer: _propTypes2.default.func,
/** Display title. */
title: _propTypes2.default.string
} : void 0;
SearchResult.handledProps = ['active', 'as', 'className', 'description', 'id', 'image', 'onClick', 'price', 'renderer', 'title'];
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 | 1 1 1 1 1 1 1 1 1 1 4 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function SearchResults(props) {
var children = props.children,
className = props.className;
var classes = (0, _classnames2.default)('results transition', className);
var rest = (0, _lib.getUnhandledProps)(SearchResults, props);
var ElementType = (0, _lib.getElementType)(SearchResults, props);
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
children
);
}
SearchResults.handledProps = ['as', 'children', 'className'];
SearchResults._meta = {
name: 'SearchResults',
parent: 'Search',
type: _lib.META.TYPES.MODULE
};
process.env.NODE_ENV !== "production" ? SearchResults.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string
} : void 0;
exports.default = SearchResults;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = undefined;
var _Search = require('./Search');
var _Search2 = _interopRequireDefault(_Search);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = _Search2.default;
|
| File | Statements | Branches | Functions | Lines | |||||
|---|---|---|---|---|---|---|---|---|---|
| Sidebar.js | 66.07% | (37 / 56) | 35.71% | (5 / 14) | 28.57% | (2 / 7) | 65.45% | (36 / 55) | |
| SidebarPushable.js | 77.27% | (17 / 22) | 83.33% | (5 / 6) | 50% | (1 / 2) | 76.19% | (16 / 21) | |
| SidebarPusher.js | 77.27% | (17 / 22) | 83.33% | (5 / 6) | 50% | (1 / 2) | 76.19% | (16 / 21) | |
| index.js | 100% | (7 / 7) | 75% | (3 / 4) | 100% | (1 / 1) | 100% | (6 / 6) |
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 | 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 10 1 1 1 1 1 1 1 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
var _createClass2 = require('babel-runtime/helpers/createClass');
var _createClass3 = _interopRequireDefault(_createClass2);
var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
var _inherits2 = require('babel-runtime/helpers/inherits');
var _inherits3 = _interopRequireDefault(_inherits2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
var _SidebarPushable = require('./SidebarPushable');
var _SidebarPushable2 = _interopRequireDefault(_SidebarPushable);
var _SidebarPusher = require('./SidebarPusher');
var _SidebarPusher2 = _interopRequireDefault(_SidebarPusher);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* A sidebar hides additional content beside a page.
*/
var Sidebar = function (_Component) {
(0, _inherits3.default)(Sidebar, _Component);
function Sidebar() {
var _ref;
var _temp, _this, _ret;
(0, _classCallCheck3.default)(this, Sidebar);
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return _ret = (_temp = (_this = (0, _possibleConstructorReturn3.default)(this, (_ref = Sidebar.__proto__ || Object.getPrototypeOf(Sidebar)).call.apply(_ref, [this].concat(args))), _this), _this.state = {}, _this.startAnimating = function () {
var duration = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 500;
clearTimeout(_this.stopAnimatingTimer);
_this.setState({ animating: true });
_this.stopAnimatingTimer = setTimeout(function () {
return _this.setState({ animating: false });
}, duration);
}, _temp), (0, _possibleConstructorReturn3.default)(_this, _ret);
}
(0, _createClass3.default)(Sidebar, [{
key: 'componentWillReceiveProps',
value: function componentWillReceiveProps(nextProps) {
if (nextProps.visible !== this.props.visible) {
this.startAnimating();
}
}
}, {
key: 'render',
value: function render() {
var _props = this.props,
animation = _props.animation,
className = _props.className,
children = _props.children,
direction = _props.direction,
visible = _props.visible,
width = _props.width;
var animating = this.state.animating;
var classes = (0, _classnames2.default)('ui', animation, direction, width, (0, _lib.useKeyOnly)(animating, 'animating'), (0, _lib.useKeyOnly)(visible, 'visible'), 'sidebar', className);
var rest = (0, _lib.getUnhandledProps)(Sidebar, this.props);
var ElementType = (0, _lib.getElementType)(Sidebar, this.props);
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
children
);
}
}]);
return Sidebar;
}(_lib.AutoControlledComponent);
Sidebar.defaultProps = {
direction: 'left'
};
Sidebar.autoControlledProps = ['visible'];
Sidebar._meta = {
name: 'Sidebar',
type: _lib.META.TYPES.MODULE
};
Sidebar.Pushable = _SidebarPushable2.default;
Sidebar.Pusher = _SidebarPusher2.default;
process.env.NODE_ENV !== "production" ? Sidebar.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Animation style. */
animation: _propTypes2.default.oneOf(['overlay', 'push', 'scale down', 'uncover', 'slide out', 'slide along']),
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string,
/** Initial value of visible. */
defaultVisible: _propTypes2.default.bool,
/** Direction the sidebar should appear on. */
direction: _propTypes2.default.oneOf(['top', 'right', 'bottom', 'left']),
/** Controls whether or not the sidebar is visible on the page. */
visible: _propTypes2.default.bool,
/** Sidebar width. */
width: _propTypes2.default.oneOf(['very thin', 'thin', 'wide', 'very wide'])
} : void 0;
Sidebar.handledProps = ['animation', 'as', 'children', 'className', 'defaultVisible', 'direction', 'visible', 'width'];
exports.default = Sidebar;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | 1 1 1 1 1 1 1 1 1 1 4 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* A pushable sub-component for Sidebar.
*/
function SidebarPushable(props) {
var className = props.className,
children = props.children;
var classes = (0, _classnames2.default)('pushable', className);
var rest = (0, _lib.getUnhandledProps)(SidebarPushable, props);
var ElementType = (0, _lib.getElementType)(SidebarPushable, props);
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
children
);
}
SidebarPushable.handledProps = ['as', 'children', 'className'];
SidebarPushable._meta = {
name: 'SidebarPushable',
type: _lib.META.TYPES.MODULE,
parent: 'Sidebar'
};
process.env.NODE_ENV !== "production" ? SidebarPushable.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string
} : void 0;
exports.default = SidebarPushable;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 | 1 1 1 1 1 1 1 1 1 1 4 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* A pushable sub-component for Sidebar.
*/
function SidebarPusher(props) {
var className = props.className,
dimmed = props.dimmed,
children = props.children;
var classes = (0, _classnames2.default)('pusher', (0, _lib.useKeyOnly)(dimmed, 'dimmed'), className);
var rest = (0, _lib.getUnhandledProps)(SidebarPusher, props);
var ElementType = (0, _lib.getElementType)(SidebarPusher, props);
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
children
);
}
SidebarPusher.handledProps = ['as', 'children', 'className', 'dimmed'];
SidebarPusher._meta = {
name: 'SidebarPusher',
type: _lib.META.TYPES.MODULE,
parent: 'Sidebar'
};
process.env.NODE_ENV !== "production" ? SidebarPusher.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string,
/** Controls whether or not the dim is displayed. */
dimmed: _propTypes2.default.bool
} : void 0;
exports.default = SidebarPusher;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = undefined;
var _Sidebar = require('./Sidebar');
var _Sidebar2 = _interopRequireDefault(_Sidebar);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = _Sidebar2.default;
|
| File | Statements | Branches | Functions | Lines | |||||
|---|---|---|---|---|---|---|---|---|---|
| Advertisement.js | 77.27% | (17 / 22) | 83.33% | (5 / 6) | 50% | (1 / 2) | 76.19% | (16 / 21) | |
| index.js | 100% | (7 / 7) | 75% | (3 / 4) | 100% | (1 / 1) | 100% | (6 / 6) |
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | 1 1 1 1 1 1 1 1 1 1 4 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* An ad displays third-party promotional content.
*/
function Advertisement(props) {
var centered = props.centered,
children = props.children,
className = props.className,
test = props.test,
unit = props.unit;
var classes = (0, _classnames2.default)('ui', unit, (0, _lib.useKeyOnly)(centered, 'centered'), (0, _lib.useKeyOnly)(test, 'test'), 'ad', className);
var rest = (0, _lib.getUnhandledProps)(Advertisement, props);
var ElementType = (0, _lib.getElementType)(Advertisement, props);
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes, 'data-text': test }),
children
);
}
Advertisement.handledProps = ['as', 'centered', 'children', 'className', 'test', 'unit'];
Advertisement._meta = {
name: 'Advertisement',
type: _lib.META.TYPES.VIEW
};
process.env.NODE_ENV !== "production" ? Advertisement.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Center the advertisement. */
centered: _propTypes2.default.bool,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string,
/** Text to be displayed on the advertisement. */
test: _propTypes2.default.oneOfType([_propTypes2.default.bool, _propTypes2.default.number, _propTypes2.default.string]),
/** Varies the size of the advertisement. */
unit: _propTypes2.default.oneOf(['medium rectangle', 'large rectangle', 'vertical rectangle', 'small rectangle', 'mobile banner', 'banner', 'vertical banner', 'top banner', 'half banner', 'button', 'square button', 'small button', 'skyscraper', 'wide skyscraper', 'leaderboard', 'large leaderboard', 'mobile leaderboard', 'billboard', 'panorama', 'netboard', 'half page', 'square', 'small square']).isRequired
} : void 0;
exports.default = Advertisement;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = undefined;
var _Advertisement = require('./Advertisement');
var _Advertisement2 = _interopRequireDefault(_Advertisement);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = _Advertisement2.default;
|
| File | Statements | Branches | Functions | Lines | |||||
|---|---|---|---|---|---|---|---|---|---|
| Card.js | 72.73% | (48 / 66) | 25% | (5 / 20) | 33.33% | (2 / 6) | 74.6% | (47 / 63) | |
| CardContent.js | 71.43% | (25 / 35) | 62.5% | (5 / 8) | 20% | (1 / 5) | 70.59% | (24 / 34) | |
| CardDescription.js | 79.17% | (19 / 24) | 62.5% | (5 / 8) | 50% | (1 / 2) | 78.26% | (18 / 23) | |
| CardGroup.js | 69.7% | (23 / 33) | 50% | (5 / 10) | 33.33% | (1 / 3) | 68.75% | (22 / 32) | |
| CardHeader.js | 79.17% | (19 / 24) | 62.5% | (5 / 8) | 50% | (1 / 2) | 78.26% | (18 / 23) | |
| CardMeta.js | 79.17% | (19 / 24) | 62.5% | (5 / 8) | 50% | (1 / 2) | 78.26% | (18 / 23) |
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 | 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 15 1 1 1 1 1 1 1 1 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _classCallCheck2 = require('babel-runtime/helpers/classCallCheck');
var _classCallCheck3 = _interopRequireDefault(_classCallCheck2);
var _createClass2 = require('babel-runtime/helpers/createClass');
var _createClass3 = _interopRequireDefault(_createClass2);
var _possibleConstructorReturn2 = require('babel-runtime/helpers/possibleConstructorReturn');
var _possibleConstructorReturn3 = _interopRequireDefault(_possibleConstructorReturn2);
var _inherits2 = require('babel-runtime/helpers/inherits');
var _inherits3 = _interopRequireDefault(_inherits2);
var _isNil2 = require('lodash/isNil');
var _isNil3 = _interopRequireDefault(_isNil2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
var _Image = require('../../elements/Image');
var _Image2 = _interopRequireDefault(_Image);
var _CardContent = require('./CardContent');
var _CardContent2 = _interopRequireDefault(_CardContent);
var _CardDescription = require('./CardDescription');
var _CardDescription2 = _interopRequireDefault(_CardDescription);
var _CardGroup = require('./CardGroup');
var _CardGroup2 = _interopRequireDefault(_CardGroup);
var _CardHeader = require('./CardHeader');
var _CardHeader2 = _interopRequireDefault(_CardHeader);
var _CardMeta = require('./CardMeta');
var _CardMeta2 = _interopRequireDefault(_CardMeta);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* A card displays site content in a manner similar to a playing card.
*/
var Card = function (_Component) {
(0, _inherits3.default)(Card, _Component);
function Card() {
var _ref;
var _temp, _this, _ret;
(0, _classCallCheck3.default)(this, Card);
for (var _len = arguments.length, args = Array(_len), _key = 0; _key < _len; _key++) {
args[_key] = arguments[_key];
}
return _ret = (_temp = (_this = (0, _possibleConstructorReturn3.default)(this, (_ref = Card.__proto__ || Object.getPrototypeOf(Card)).call.apply(_ref, [this].concat(args))), _this), _this.handleClick = function (e) {
var onClick = _this.props.onClick;
if (onClick) onClick(e, _this.props);
}, _temp), (0, _possibleConstructorReturn3.default)(_this, _ret);
}
(0, _createClass3.default)(Card, [{
key: 'render',
value: function render() {
var _props = this.props,
centered = _props.centered,
children = _props.children,
className = _props.className,
color = _props.color,
description = _props.description,
extra = _props.extra,
fluid = _props.fluid,
header = _props.header,
href = _props.href,
image = _props.image,
link = _props.link,
meta = _props.meta,
onClick = _props.onClick,
raised = _props.raised;
var classes = (0, _classnames2.default)('ui', color, (0, _lib.useKeyOnly)(centered, 'centered'), (0, _lib.useKeyOnly)(fluid, 'fluid'), (0, _lib.useKeyOnly)(link, 'link'), (0, _lib.useKeyOnly)(raised, 'raised'), 'card', className);
var rest = (0, _lib.getUnhandledProps)(Card, this.props);
var ElementType = (0, _lib.getElementType)(Card, this.props, function () {
if (onClick) return 'a';
});
if (!(0, _isNil3.default)(children)) {
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes, href: href, onClick: this.handleClick }),
children
);
}
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes, href: href, onClick: this.handleClick }),
_Image2.default.create(image),
(description || header || meta) && _react2.default.createElement(_CardContent2.default, { description: description, header: header, meta: meta }),
extra && _react2.default.createElement(
_CardContent2.default,
{ extra: true },
extra
)
);
}
}]);
return Card;
}(_react.Component);
Card._meta = {
name: 'Card',
type: _lib.META.TYPES.VIEW
};
Card.Content = _CardContent2.default;
Card.Description = _CardDescription2.default;
Card.Group = _CardGroup2.default;
Card.Header = _CardHeader2.default;
Card.Meta = _CardMeta2.default;
exports.default = Card;
process.env.NODE_ENV !== "production" ? Card.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** A Card can center itself inside its container. */
centered: _propTypes2.default.bool,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string,
/** A Card can be formatted to display different colors. */
color: _propTypes2.default.oneOf(_lib.SUI.COLORS),
/** Shorthand for CardDescription. */
description: _lib.customPropTypes.itemShorthand,
/** Shorthand for primary content of CardContent. */
extra: _lib.customPropTypes.contentShorthand,
/** A Card can be formatted to take up the width of its container. */
fluid: _propTypes2.default.bool,
/** Shorthand for CardHeader. */
header: _lib.customPropTypes.itemShorthand,
/** Render as an `a` tag instead of a `div` and adds the href attribute. */
href: _propTypes2.default.string,
/** A card can contain an Image component. */
image: _lib.customPropTypes.itemShorthand,
/** A card can be formatted to link to other content. */
link: _propTypes2.default.bool,
/** Shorthand for CardMeta. */
meta: _lib.customPropTypes.itemShorthand,
/**
* Called on click. When passed, the component renders as an `a`
* tag by default instead of a `div`.
*
* @param {SyntheticEvent} event - React's original SyntheticEvent.
* @param {object} data - All props.
*/
onClick: _propTypes2.default.func,
/** A Card can be formatted to raise above the page. */
raised: _propTypes2.default.bool
} : void 0;
Card.handledProps = ['as', 'centered', 'children', 'className', 'color', 'description', 'extra', 'fluid', 'header', 'href', 'image', 'link', 'meta', 'onClick', 'raised'];
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 | 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 8 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _isNil2 = require('lodash/isNil');
var _isNil3 = _interopRequireDefault(_isNil2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
var _CardDescription = require('./CardDescription');
var _CardDescription2 = _interopRequireDefault(_CardDescription);
var _CardHeader = require('./CardHeader');
var _CardHeader2 = _interopRequireDefault(_CardHeader);
var _CardMeta = require('./CardMeta');
var _CardMeta2 = _interopRequireDefault(_CardMeta);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* A card can contain blocks of content or extra content meant to be formatted separately from the main content.
*/
function CardContent(props) {
var children = props.children,
className = props.className,
description = props.description,
extra = props.extra,
header = props.header,
meta = props.meta;
var classes = (0, _classnames2.default)(className, (0, _lib.useKeyOnly)(extra, 'extra'), 'content');
var rest = (0, _lib.getUnhandledProps)(CardContent, props);
var ElementType = (0, _lib.getElementType)(CardContent, props);
if (!(0, _isNil3.default)(children)) {
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
children
);
}
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
(0, _lib.createShorthand)(_CardHeader2.default, function (val) {
return { content: val };
}, header),
(0, _lib.createShorthand)(_CardMeta2.default, function (val) {
return { content: val };
}, meta),
(0, _lib.createShorthand)(_CardDescription2.default, function (val) {
return { content: val };
}, description)
);
}
CardContent.handledProps = ['as', 'children', 'className', 'description', 'extra', 'header', 'meta'];
CardContent._meta = {
name: 'CardContent',
parent: 'Card',
type: _lib.META.TYPES.VIEW
};
process.env.NODE_ENV !== "production" ? CardContent.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string,
/** Shorthand for CardDescription. */
description: _lib.customPropTypes.itemShorthand,
/** A card can contain extra content meant to be formatted separately from the main content. */
extra: _propTypes2.default.bool,
/** Shorthand for CardHeader. */
header: _lib.customPropTypes.itemShorthand,
/** Shorthand for CardMeta. */
meta: _lib.customPropTypes.itemShorthand
} : void 0;
exports.default = CardContent;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | 1 1 1 1 1 1 1 1 1 1 1 1 5 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _isNil2 = require('lodash/isNil');
var _isNil3 = _interopRequireDefault(_isNil2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* A card can contain a description with one or more paragraphs.
*/
function CardDescription(props) {
var children = props.children,
className = props.className,
content = props.content;
var classes = (0, _classnames2.default)(className, 'description');
var rest = (0, _lib.getUnhandledProps)(CardDescription, props);
var ElementType = (0, _lib.getElementType)(CardDescription, props);
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
(0, _isNil3.default)(children) ? content : children
);
}
CardDescription.handledProps = ['as', 'children', 'className', 'content'];
CardDescription._meta = {
name: 'CardDescription',
parent: 'Card',
type: _lib.META.TYPES.VIEW
};
process.env.NODE_ENV !== "production" ? CardDescription.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string,
/** Shorthand for primary content. */
content: _lib.customPropTypes.contentShorthand
} : void 0;
exports.default = CardDescription;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 | 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 7 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _map2 = require('lodash/map');
var _map3 = _interopRequireDefault(_map2);
var _isNil2 = require('lodash/isNil');
var _isNil3 = _interopRequireDefault(_isNil2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
var _Card = require('./Card');
var _Card2 = _interopRequireDefault(_Card);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* A group of cards.
*/
function CardGroup(props) {
var children = props.children,
className = props.className,
doubling = props.doubling,
items = props.items,
itemsPerRow = props.itemsPerRow,
stackable = props.stackable;
var classes = (0, _classnames2.default)('ui', (0, _lib.useKeyOnly)(doubling, 'doubling'), (0, _lib.useKeyOnly)(stackable, 'stackable'), (0, _lib.useWidthProp)(itemsPerRow), className, 'cards');
var rest = (0, _lib.getUnhandledProps)(CardGroup, props);
var ElementType = (0, _lib.getElementType)(CardGroup, props);
if (!(0, _isNil3.default)(children)) {
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
children
);
}
var content = (0, _map3.default)(items, function (item) {
var key = item.key || [item.header, item.description].join('-');
return _react2.default.createElement(_Card2.default, (0, _extends3.default)({ key: key }, item));
});
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
content
);
}
CardGroup.handledProps = ['as', 'children', 'className', 'doubling', 'items', 'itemsPerRow', 'stackable'];
CardGroup._meta = {
name: 'CardGroup',
parent: 'Card',
type: _lib.META.TYPES.VIEW
};
process.env.NODE_ENV !== "production" ? CardGroup.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string,
/** A group of cards can double its column width for mobile. */
doubling: _propTypes2.default.bool,
/** Shorthand array of props for Card. */
items: _lib.customPropTypes.collectionShorthand,
/** A group of cards can set how many cards should exist in a row. */
itemsPerRow: _propTypes2.default.oneOf(_lib.SUI.WIDTHS),
/** A group of cards can automatically stack rows to a single columns on mobile devices. */
stackable: _propTypes2.default.bool
} : void 0;
exports.default = CardGroup;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | 1 1 1 1 1 1 1 1 1 1 1 1 5 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _isNil2 = require('lodash/isNil');
var _isNil3 = _interopRequireDefault(_isNil2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* A card can contain a header.
*/
function CardHeader(props) {
var children = props.children,
className = props.className,
content = props.content;
var classes = (0, _classnames2.default)(className, 'header');
var rest = (0, _lib.getUnhandledProps)(CardHeader, props);
var ElementType = (0, _lib.getElementType)(CardHeader, props);
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
(0, _isNil3.default)(children) ? content : children
);
}
CardHeader.handledProps = ['as', 'children', 'className', 'content'];
CardHeader._meta = {
name: 'CardHeader',
parent: 'Card',
type: _lib.META.TYPES.VIEW
};
process.env.NODE_ENV !== "production" ? CardHeader.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string,
/** Shorthand for primary content. */
content: _lib.customPropTypes.contentShorthand
} : void 0;
exports.default = CardHeader;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | 1 1 1 1 1 1 1 1 1 1 1 1 5 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _isNil2 = require('lodash/isNil');
var _isNil3 = _interopRequireDefault(_isNil2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* A card can contain content metadata.
*/
function CardMeta(props) {
var children = props.children,
className = props.className,
content = props.content;
var classes = (0, _classnames2.default)(className, 'meta');
var rest = (0, _lib.getUnhandledProps)(CardMeta, props);
var ElementType = (0, _lib.getElementType)(CardMeta, props);
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
(0, _isNil3.default)(children) ? content : children
);
}
CardMeta.handledProps = ['as', 'children', 'className', 'content'];
CardMeta._meta = {
name: 'CardMeta',
parent: 'Card',
type: _lib.META.TYPES.VIEW
};
process.env.NODE_ENV !== "production" ? CardMeta.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string,
/** Shorthand for primary content. */
content: _lib.customPropTypes.contentShorthand
} : void 0;
exports.default = CardMeta;
|
| File | Statements | Branches | Functions | Lines | |||||
|---|---|---|---|---|---|---|---|---|---|
| Comment.js | 89.13% | (41 / 46) | 83.33% | (5 / 6) | 50% | (1 / 2) | 88.89% | (40 / 45) | |
| CommentAction.js | 78.26% | (18 / 23) | 83.33% | (5 / 6) | 50% | (1 / 2) | 77.27% | (17 / 22) | |
| CommentActions.js | 77.27% | (17 / 22) | 83.33% | (5 / 6) | 50% | (1 / 2) | 76.19% | (16 / 21) | |
| CommentAuthor.js | 77.27% | (17 / 22) | 83.33% | (5 / 6) | 50% | (1 / 2) | 76.19% | (16 / 21) | |
| CommentAvatar.js | 77.27% | (17 / 22) | 83.33% | (5 / 6) | 50% | (1 / 2) | 76.19% | (16 / 21) | |
| CommentContent.js | 77.27% | (17 / 22) | 83.33% | (5 / 6) | 50% | (1 / 2) | 76.19% | (16 / 21) | |
| CommentGroup.js | 79.17% | (19 / 24) | 83.33% | (5 / 6) | 50% | (1 / 2) | 78.26% | (18 / 23) | |
| CommentMetadata.js | 77.27% | (17 / 22) | 83.33% | (5 / 6) | 50% | (1 / 2) | 76.19% | (16 / 21) | |
| CommentText.js | 77.27% | (17 / 22) | 83.33% | (5 / 6) | 50% | (1 / 2) | 76.19% | (16 / 21) | |
| index.js | 100% | (7 / 7) | 75% | (3 / 4) | 100% | (1 / 1) | 100% | (6 / 6) |
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 | 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 12 1 1 1 1 1 1 1 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
var _CommentAction = require('./CommentAction');
var _CommentAction2 = _interopRequireDefault(_CommentAction);
var _CommentActions = require('./CommentActions');
var _CommentActions2 = _interopRequireDefault(_CommentActions);
var _CommentAuthor = require('./CommentAuthor');
var _CommentAuthor2 = _interopRequireDefault(_CommentAuthor);
var _CommentAvatar = require('./CommentAvatar');
var _CommentAvatar2 = _interopRequireDefault(_CommentAvatar);
var _CommentContent = require('./CommentContent');
var _CommentContent2 = _interopRequireDefault(_CommentContent);
var _CommentGroup = require('./CommentGroup');
var _CommentGroup2 = _interopRequireDefault(_CommentGroup);
var _CommentMetadata = require('./CommentMetadata');
var _CommentMetadata2 = _interopRequireDefault(_CommentMetadata);
var _CommentText = require('./CommentText');
var _CommentText2 = _interopRequireDefault(_CommentText);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* A comment displays user feedback to site content.
*/
function Comment(props) {
var className = props.className,
children = props.children,
collapsed = props.collapsed;
var classes = (0, _classnames2.default)((0, _lib.useKeyOnly)(collapsed, 'collapsed'), 'comment', className);
var rest = (0, _lib.getUnhandledProps)(Comment, props);
var ElementType = (0, _lib.getElementType)(Comment, props);
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
children
);
}
Comment.handledProps = ['as', 'children', 'className', 'collapsed'];
Comment._meta = {
name: 'Comment',
type: _lib.META.TYPES.VIEW
};
process.env.NODE_ENV !== "production" ? Comment.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string,
/** Comment can be collapsed, or hidden from view. */
collapsed: _propTypes2.default.bool
} : void 0;
Comment.Author = _CommentAuthor2.default;
Comment.Action = _CommentAction2.default;
Comment.Actions = _CommentActions2.default;
Comment.Avatar = _CommentAvatar2.default;
Comment.Content = _CommentContent2.default;
Comment.Group = _CommentGroup2.default;
Comment.Metadata = _CommentMetadata2.default;
Comment.Text = _CommentText2.default;
exports.default = Comment;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 | 1 1 1 1 1 1 1 1 1 1 4 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* A comment can contain an action.
*/
function CommentAction(props) {
var active = props.active,
className = props.className,
children = props.children;
var classes = (0, _classnames2.default)((0, _lib.useKeyOnly)(active, 'active'), className);
var rest = (0, _lib.getUnhandledProps)(CommentAction, props);
var ElementType = (0, _lib.getElementType)(CommentAction, props);
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
children
);
}
CommentAction.handledProps = ['active', 'as', 'children', 'className'];
CommentAction._meta = {
name: 'CommentAction',
parent: 'Comment',
type: _lib.META.TYPES.VIEW
};
CommentAction.defaultProps = {
as: 'a'
};
process.env.NODE_ENV !== "production" ? CommentAction.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Style as the currently active action. */
active: _propTypes2.default.bool,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string
} : void 0;
exports.default = CommentAction;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | 1 1 1 1 1 1 1 1 1 1 4 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* A comment can contain an list of actions a user may perform related to this comment.
*/
function CommentActions(props) {
var className = props.className,
children = props.children;
var classes = (0, _classnames2.default)('actions', className);
var rest = (0, _lib.getUnhandledProps)(CommentActions, props);
var ElementType = (0, _lib.getElementType)(CommentActions, props);
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
children
);
}
CommentActions.handledProps = ['as', 'children', 'className'];
CommentActions._meta = {
name: 'CommentActions',
parent: 'Comment',
type: _lib.META.TYPES.VIEW
};
process.env.NODE_ENV !== "production" ? CommentActions.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string
} : void 0;
exports.default = CommentActions;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | 1 1 1 1 1 1 1 1 1 1 4 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* A comment can contain an author.
*/
function CommentAuthor(props) {
var className = props.className,
children = props.children;
var classes = (0, _classnames2.default)('author', className);
var rest = (0, _lib.getUnhandledProps)(CommentAuthor, props);
var ElementType = (0, _lib.getElementType)(CommentAuthor, props);
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
children
);
}
CommentAuthor.handledProps = ['as', 'children', 'className'];
CommentAuthor._meta = {
name: 'CommentAuthor',
parent: 'Comment',
type: _lib.META.TYPES.VIEW
};
process.env.NODE_ENV !== "production" ? CommentAuthor.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string
} : void 0;
exports.default = CommentAuthor;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | 1 1 1 1 1 1 1 1 1 1 4 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* A comment can contain an image or avatar.
*/
function CommentAvatar(props) {
var className = props.className,
src = props.src;
var classes = (0, _classnames2.default)('avatar', className);
var rest = (0, _lib.getUnhandledProps)(CommentAvatar, props);
var ElementType = (0, _lib.getElementType)(CommentAvatar, props);
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
(0, _lib.createHTMLImage)(src)
);
}
CommentAvatar.handledProps = ['as', 'className', 'src'];
CommentAvatar._meta = {
name: 'CommentAvatar',
parent: 'Comment',
type: _lib.META.TYPES.VIEW
};
process.env.NODE_ENV !== "production" ? CommentAvatar.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Additional classes. */
className: _propTypes2.default.string,
/** Specifies the URL of the image. */
src: _propTypes2.default.string
} : void 0;
exports.default = CommentAvatar;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | 1 1 1 1 1 1 1 1 1 1 4 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* A comment can contain content.
*/
function CommentContent(props) {
var className = props.className,
children = props.children;
var classes = (0, _classnames2.default)(className, 'content');
var rest = (0, _lib.getUnhandledProps)(CommentContent, props);
var ElementType = (0, _lib.getElementType)(CommentContent, props);
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
children
);
}
CommentContent.handledProps = ['as', 'children', 'className'];
CommentContent._meta = {
name: 'CommentContent',
parent: 'Comment',
type: _lib.META.TYPES.VIEW
};
process.env.NODE_ENV !== "production" ? CommentContent.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string
} : void 0;
exports.default = CommentContent;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 | 1 1 1 1 1 1 1 1 1 1 1 1 5 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _without2 = require('lodash/without');
var _without3 = _interopRequireDefault(_without2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* Comments can be grouped.
*/
function CommentGroup(props) {
var className = props.className,
children = props.children,
collapsed = props.collapsed,
minimal = props.minimal,
size = props.size,
threaded = props.threaded;
var classes = (0, _classnames2.default)('ui', size, (0, _lib.useKeyOnly)(collapsed, 'collapsed'), (0, _lib.useKeyOnly)(minimal, 'minimal'), (0, _lib.useKeyOnly)(threaded, 'threaded'), 'comments', className);
var rest = (0, _lib.getUnhandledProps)(CommentGroup, props);
var ElementType = (0, _lib.getElementType)(CommentGroup, props);
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
children
);
}
CommentGroup.handledProps = ['as', 'children', 'className', 'collapsed', 'minimal', 'size', 'threaded'];
CommentGroup._meta = {
name: 'CommentGroup',
parent: 'Comment',
type: _lib.META.TYPES.VIEW
};
process.env.NODE_ENV !== "production" ? CommentGroup.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string,
/** Comments can be collapsed, or hidden from view. */
collapsed: _propTypes2.default.bool,
/** Comments can hide extra information unless a user shows intent to interact with a comment. */
minimal: _propTypes2.default.bool,
/** Comments can have different sizes. */
size: _propTypes2.default.oneOf((0, _without3.default)(_lib.SUI.SIZES, 'medium')),
/** A comment list can be threaded to showing the relationship between conversations. */
threaded: _propTypes2.default.bool
} : void 0;
exports.default = CommentGroup;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | 1 1 1 1 1 1 1 1 1 1 4 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* A comment can contain metadata about the comment, an arbitrary amount of metadata may be defined.
*/
function CommentMetadata(props) {
var className = props.className,
children = props.children;
var classes = (0, _classnames2.default)('metadata', className);
var rest = (0, _lib.getUnhandledProps)(CommentMetadata, props);
var ElementType = (0, _lib.getElementType)(CommentMetadata, props);
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
children
);
}
CommentMetadata.handledProps = ['as', 'children', 'className'];
CommentMetadata._meta = {
name: 'CommentMetadata',
parent: 'Comment',
type: _lib.META.TYPES.VIEW
};
process.env.NODE_ENV !== "production" ? CommentMetadata.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string
} : void 0;
exports.default = CommentMetadata;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 | 1 1 1 1 1 1 1 1 1 1 4 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* A comment can contain text.
*/
function CommentText(props) {
var className = props.className,
children = props.children;
var classes = (0, _classnames2.default)(className, 'text');
var rest = (0, _lib.getUnhandledProps)(CommentText, props);
var ElementType = (0, _lib.getElementType)(CommentText, props);
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
children
);
}
CommentText.handledProps = ['as', 'children', 'className'];
CommentText._meta = {
name: 'CommentText',
parent: 'Comment',
type: _lib.META.TYPES.VIEW
};
process.env.NODE_ENV !== "production" ? CommentText.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string
} : void 0;
exports.default = CommentText;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = undefined;
var _Comment = require('./Comment');
var _Comment2 = _interopRequireDefault(_Comment);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = _Comment2.default;
|
| File | Statements | Branches | Functions | Lines | |||||
|---|---|---|---|---|---|---|---|---|---|
| Feed.js | 82.54% | (52 / 63) | 50% | (5 / 10) | 33.33% | (1 / 3) | 82.26% | (51 / 62) | |
| FeedContent.js | 69.23% | (27 / 39) | 62.5% | (5 / 8) | 14.29% | (1 / 7) | 68.42% | (26 / 38) | |
| FeedDate.js | 79.17% | (19 / 24) | 62.5% | (5 / 8) | 50% | (1 / 2) | 78.26% | (18 / 23) | |
| FeedEvent.js | 70% | (21 / 30) | 35.71% | (5 / 14) | 25% | (1 / 4) | 68.97% | (20 / 29) | |
| FeedExtra.js | 67.74% | (21 / 31) | 50% | (5 / 10) | 33.33% | (1 / 3) | 66.67% | (20 / 30) | |
| FeedLabel.js | 75% | (21 / 28) | 62.5% | (5 / 8) | 50% | (1 / 2) | 74.07% | (20 / 27) | |
| FeedLike.js | 75.86% | (22 / 29) | 62.5% | (5 / 8) | 50% | (1 / 2) | 75% | (21 / 28) | |
| FeedMeta.js | 72.41% | (21 / 29) | 62.5% | (5 / 8) | 33.33% | (1 / 3) | 71.43% | (20 / 28) | |
| FeedSummary.js | 71.88% | (23 / 32) | 62.5% | (5 / 8) | 25% | (1 / 4) | 70.97% | (22 / 31) | |
| FeedUser.js | 80% | (20 / 25) | 62.5% | (5 / 8) | 50% | (1 / 2) | 79.17% | (19 / 24) | |
| index.js | 100% | (7 / 7) | 75% | (3 / 4) | 100% | (1 / 1) | 100% | (6 / 6) |
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 | 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 17 1 1 1 1 1 1 1 1 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _objectWithoutProperties2 = require('babel-runtime/helpers/objectWithoutProperties');
var _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2);
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _without2 = require('lodash/without');
var _without3 = _interopRequireDefault(_without2);
var _map2 = require('lodash/map');
var _map3 = _interopRequireDefault(_map2);
var _isNil2 = require('lodash/isNil');
var _isNil3 = _interopRequireDefault(_isNil2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
var _FeedContent = require('./FeedContent');
var _FeedContent2 = _interopRequireDefault(_FeedContent);
var _FeedDate = require('./FeedDate');
var _FeedDate2 = _interopRequireDefault(_FeedDate);
var _FeedEvent = require('./FeedEvent');
var _FeedEvent2 = _interopRequireDefault(_FeedEvent);
var _FeedExtra = require('./FeedExtra');
var _FeedExtra2 = _interopRequireDefault(_FeedExtra);
var _FeedLabel = require('./FeedLabel');
var _FeedLabel2 = _interopRequireDefault(_FeedLabel);
var _FeedLike = require('./FeedLike');
var _FeedLike2 = _interopRequireDefault(_FeedLike);
var _FeedMeta = require('./FeedMeta');
var _FeedMeta2 = _interopRequireDefault(_FeedMeta);
var _FeedSummary = require('./FeedSummary');
var _FeedSummary2 = _interopRequireDefault(_FeedSummary);
var _FeedUser = require('./FeedUser');
var _FeedUser2 = _interopRequireDefault(_FeedUser);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* A feed presents user activity chronologically.
*/
function Feed(props) {
var children = props.children,
className = props.className,
events = props.events,
size = props.size;
var classes = (0, _classnames2.default)('ui', size, 'feed', className);
var rest = (0, _lib.getUnhandledProps)(Feed, props);
var ElementType = (0, _lib.getElementType)(Feed, props);
if (!(0, _isNil3.default)(children)) {
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
children
);
}
var eventElements = (0, _map3.default)(events, function (eventProps) {
var childKey = eventProps.childKey,
date = eventProps.date,
meta = eventProps.meta,
summary = eventProps.summary,
eventData = (0, _objectWithoutProperties3.default)(eventProps, ['childKey', 'date', 'meta', 'summary']);
var finalKey = childKey || [date, meta, summary].join('-');
return _react2.default.createElement(_FeedEvent2.default, (0, _extends3.default)({
date: date,
key: finalKey,
meta: meta,
summary: summary
}, eventData));
});
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
eventElements
);
}
Feed.handledProps = ['as', 'children', 'className', 'events', 'size'];
Feed._meta = {
name: 'Feed',
type: _lib.META.TYPES.VIEW
};
process.env.NODE_ENV !== "production" ? Feed.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string,
/** Shorthand array of props for FeedEvent. */
events: _lib.customPropTypes.collectionShorthand,
/** A feed can have different sizes. */
size: _propTypes2.default.oneOf((0, _without3.default)(_lib.SUI.SIZES, 'mini', 'tiny', 'medium', 'big', 'huge', 'massive'))
} : void 0;
Feed.Content = _FeedContent2.default;
Feed.Date = _FeedDate2.default;
Feed.Event = _FeedEvent2.default;
Feed.Extra = _FeedExtra2.default;
Feed.Label = _FeedLabel2.default;
Feed.Like = _FeedLike2.default;
Feed.Meta = _FeedMeta2.default;
Feed.Summary = _FeedSummary2.default;
Feed.User = _FeedUser2.default;
exports.default = Feed;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 | 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 9 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _isNil2 = require('lodash/isNil');
var _isNil3 = _interopRequireDefault(_isNil2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
var _FeedDate = require('./FeedDate');
var _FeedDate2 = _interopRequireDefault(_FeedDate);
var _FeedExtra = require('./FeedExtra');
var _FeedExtra2 = _interopRequireDefault(_FeedExtra);
var _FeedMeta = require('./FeedMeta');
var _FeedMeta2 = _interopRequireDefault(_FeedMeta);
var _FeedSummary = require('./FeedSummary');
var _FeedSummary2 = _interopRequireDefault(_FeedSummary);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
function FeedContent(props) {
var children = props.children,
className = props.className,
content = props.content,
extraImages = props.extraImages,
extraText = props.extraText,
date = props.date,
meta = props.meta,
summary = props.summary;
var classes = (0, _classnames2.default)('content', className);
var rest = (0, _lib.getUnhandledProps)(FeedContent, props);
var ElementType = (0, _lib.getElementType)(FeedContent, props);
if (!(0, _isNil3.default)(children)) {
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
children
);
}
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
(0, _lib.createShorthand)(_FeedDate2.default, function (val) {
return { content: val };
}, date),
(0, _lib.createShorthand)(_FeedSummary2.default, function (val) {
return { content: val };
}, summary),
content,
(0, _lib.createShorthand)(_FeedExtra2.default, function (val) {
return { text: true, content: val };
}, extraText),
(0, _lib.createShorthand)(_FeedExtra2.default, function (val) {
return { images: val };
}, extraImages),
(0, _lib.createShorthand)(_FeedMeta2.default, function (val) {
return { content: val };
}, meta)
);
}
FeedContent.handledProps = ['as', 'children', 'className', 'content', 'date', 'extraImages', 'extraText', 'meta', 'summary'];
FeedContent._meta = {
name: 'FeedContent',
parent: 'Feed',
type: _lib.META.TYPES.VIEW
};
process.env.NODE_ENV !== "production" ? FeedContent.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string,
/** Shorthand for primary content. */
content: _lib.customPropTypes.contentShorthand,
/** An event can contain a date. */
date: _lib.customPropTypes.itemShorthand,
/** Shorthand for FeedExtra with images. */
extraImages: _FeedExtra2.default.propTypes.images,
/** Shorthand for FeedExtra with text. */
extraText: _lib.customPropTypes.itemShorthand,
/** Shorthand for FeedMeta. */
meta: _lib.customPropTypes.itemShorthand,
/** Shorthand for FeedSummary. */
summary: _lib.customPropTypes.itemShorthand
} : void 0;
exports.default = FeedContent;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | 1 1 1 1 1 1 1 1 1 1 1 1 5 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _isNil2 = require('lodash/isNil');
var _isNil3 = _interopRequireDefault(_isNil2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* An event or an event summary can contain a date.
*/
function FeedDate(props) {
var children = props.children,
className = props.className,
content = props.content;
var classes = (0, _classnames2.default)('date', className);
var rest = (0, _lib.getUnhandledProps)(FeedDate, props);
var ElementType = (0, _lib.getElementType)(FeedDate, props);
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
(0, _isNil3.default)(children) ? content : children
);
}
FeedDate.handledProps = ['as', 'children', 'className', 'content'];
FeedDate._meta = {
name: 'FeedDate',
parent: 'Feed',
type: _lib.META.TYPES.VIEW
};
process.env.NODE_ENV !== "production" ? FeedDate.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string,
/** Shorthand for primary content. */
content: _lib.customPropTypes.contentShorthand
} : void 0;
exports.default = FeedDate;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | 1 1 1 1 1 1 1 1 1 1 1 1 1 1 6 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
var _FeedContent = require('./FeedContent');
var _FeedContent2 = _interopRequireDefault(_FeedContent);
var _FeedLabel = require('./FeedLabel');
var _FeedLabel2 = _interopRequireDefault(_FeedLabel);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* A feed contains an event.
*/
function FeedEvent(props) {
var content = props.content,
children = props.children,
className = props.className,
date = props.date,
extraImages = props.extraImages,
extraText = props.extraText,
image = props.image,
icon = props.icon,
meta = props.meta,
summary = props.summary;
var classes = (0, _classnames2.default)('event', className);
var rest = (0, _lib.getUnhandledProps)(FeedEvent, props);
var ElementType = (0, _lib.getElementType)(FeedEvent, props);
var hasContentProp = content || date || extraImages || extraText || meta || summary;
var contentProps = { content: content, date: date, extraImages: extraImages, extraText: extraText, meta: meta, summary: summary };
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
(0, _lib.createShorthand)(_FeedLabel2.default, function (val) {
return { icon: val };
}, icon),
(0, _lib.createShorthand)(_FeedLabel2.default, function (val) {
return { image: val };
}, image),
hasContentProp && _react2.default.createElement(_FeedContent2.default, contentProps),
children
);
}
FeedEvent.handledProps = ['as', 'children', 'className', 'content', 'date', 'extraImages', 'extraText', 'icon', 'image', 'meta', 'summary'];
FeedEvent._meta = {
name: 'FeedEvent',
parent: 'Feed',
type: _lib.META.TYPES.VIEW
};
process.env.NODE_ENV !== "production" ? FeedEvent.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string,
/** Shorthand for FeedContent. */
content: _lib.customPropTypes.itemShorthand,
/** Shorthand for FeedDate. */
date: _lib.customPropTypes.itemShorthand,
/** Shorthand for FeedExtra with images. */
extraImages: _lib.customPropTypes.itemShorthand,
/** Shorthand for FeedExtra with content. */
extraText: _lib.customPropTypes.itemShorthand,
/** An event can contain icon label. */
icon: _lib.customPropTypes.itemShorthand,
/** An event can contain image label. */
image: _lib.customPropTypes.itemShorthand,
/** Shorthand for FeedMeta. */
meta: _lib.customPropTypes.itemShorthand,
/** Shorthand for FeedSummary. */
summary: _lib.customPropTypes.itemShorthand
} : void 0;
exports.default = FeedEvent;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 | 1 1 1 1 1 1 1 1 1 1 1 1 1 1 6 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _map2 = require('lodash/map');
var _map3 = _interopRequireDefault(_map2);
var _isNil2 = require('lodash/isNil');
var _isNil3 = _interopRequireDefault(_isNil2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* A feed can contain an extra content.
*/
function FeedExtra(props) {
var children = props.children,
className = props.className,
content = props.content,
images = props.images,
text = props.text;
var classes = (0, _classnames2.default)((0, _lib.useKeyOnly)(images, 'images'), (0, _lib.useKeyOnly)(content || text, 'text'), 'extra', className);
var rest = (0, _lib.getUnhandledProps)(FeedExtra, props);
var ElementType = (0, _lib.getElementType)(FeedExtra, props);
if (!(0, _isNil3.default)(children)) {
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
children
);
}
// TODO need a "collection factory" to handle creating multiple image elements and their keys
var imageElements = (0, _map3.default)(images, function (image, index) {
var key = [index, image].join('-');
return (0, _lib.createHTMLImage)(image, { key: key });
});
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
content,
imageElements
);
}
FeedExtra.handledProps = ['as', 'children', 'className', 'content', 'images', 'text'];
FeedExtra._meta = {
name: 'FeedExtra',
parent: 'Feed',
type: _lib.META.TYPES.VIEW
};
process.env.NODE_ENV !== "production" ? FeedExtra.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string,
/** Shorthand for primary content. */
content: _lib.customPropTypes.contentShorthand,
/** An event can contain additional information like a set of images. */
images: _lib.customPropTypes.every([_lib.customPropTypes.disallow(['text']), _propTypes2.default.oneOfType([_propTypes2.default.bool, _lib.customPropTypes.collectionShorthand])]),
/** An event can contain additional text information. */
text: _propTypes2.default.bool
} : void 0;
exports.default = FeedExtra;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 | 1 1 1 1 1 1 1 1 1 1 1 1 1 1 6 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _isNil2 = require('lodash/isNil');
var _isNil3 = _interopRequireDefault(_isNil2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
var _Icon = require('../../elements/Icon');
var _Icon2 = _interopRequireDefault(_Icon);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* An event can contain an image or icon label.
*/
function FeedLabel(props) {
var children = props.children,
className = props.className,
content = props.content,
icon = props.icon,
image = props.image;
var classes = (0, _classnames2.default)('label', className);
var rest = (0, _lib.getUnhandledProps)(FeedLabel, props);
var ElementType = (0, _lib.getElementType)(FeedLabel, props);
if (!(0, _isNil3.default)(children)) {
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
children
);
}
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
content,
_Icon2.default.create(icon),
(0, _lib.createHTMLImage)(image)
);
}
FeedLabel.handledProps = ['as', 'children', 'className', 'content', 'icon', 'image'];
FeedLabel._meta = {
name: 'FeedLabel',
parent: 'Feed',
type: _lib.META.TYPES.VIEW
};
process.env.NODE_ENV !== "production" ? FeedLabel.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string,
/** Shorthand for primary content. */
content: _lib.customPropTypes.contentShorthand,
/** An event can contain icon label. */
icon: _lib.customPropTypes.itemShorthand,
/** An event can contain image label. */
image: _lib.customPropTypes.itemShorthand
} : void 0;
exports.default = FeedLabel;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 | 1 1 1 1 1 1 1 1 1 1 1 1 1 1 6 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _isNil2 = require('lodash/isNil');
var _isNil3 = _interopRequireDefault(_isNil2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
var _Icon = require('../../elements/Icon');
var _Icon2 = _interopRequireDefault(_Icon);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* A feed can contain a like element.
*/
function FeedLike(props) {
var children = props.children,
className = props.className,
content = props.content,
icon = props.icon;
var classes = (0, _classnames2.default)('like', className);
var rest = (0, _lib.getUnhandledProps)(FeedLike, props);
var ElementType = (0, _lib.getElementType)(FeedLike, props);
if (!(0, _isNil3.default)(children)) {
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
children
);
}
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
_Icon2.default.create(icon),
content
);
}
FeedLike.handledProps = ['as', 'children', 'className', 'content', 'icon'];
FeedLike._meta = {
name: 'FeedLike',
parent: 'Feed',
type: _lib.META.TYPES.VIEW
};
FeedLike.defaultProps = {
as: 'a'
};
process.env.NODE_ENV !== "production" ? FeedLike.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string,
/** Shorthand for primary content. */
content: _lib.customPropTypes.contentShorthand,
/** Shorthand for icon. Mutually exclusive with children. */
icon: _lib.customPropTypes.itemShorthand
} : void 0;
exports.default = FeedLike;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 | 1 1 1 1 1 1 1 1 1 1 1 1 1 1 6 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _isNil2 = require('lodash/isNil');
var _isNil3 = _interopRequireDefault(_isNil2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
var _FeedLike = require('./FeedLike');
var _FeedLike2 = _interopRequireDefault(_FeedLike);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* A feed can contain a meta.
*/
function FeedMeta(props) {
var children = props.children,
className = props.className,
content = props.content,
like = props.like;
var classes = (0, _classnames2.default)('meta', className);
var rest = (0, _lib.getUnhandledProps)(FeedMeta, props);
var ElementType = (0, _lib.getElementType)(FeedMeta, props);
if (!(0, _isNil3.default)(children)) {
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
children
);
}
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
(0, _lib.createShorthand)(_FeedLike2.default, function (val) {
return { content: val };
}, like),
content
);
}
FeedMeta.handledProps = ['as', 'children', 'className', 'content', 'like'];
FeedMeta._meta = {
name: 'FeedMeta',
parent: 'Feed',
type: _lib.META.TYPES.VIEW
};
process.env.NODE_ENV !== "production" ? FeedMeta.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string,
/** Shorthand for primary content. */
content: _lib.customPropTypes.contentShorthand,
/** Shorthand for FeedLike. */
like: _lib.customPropTypes.itemShorthand
} : void 0;
exports.default = FeedMeta;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 | 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 7 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _isNil2 = require('lodash/isNil');
var _isNil3 = _interopRequireDefault(_isNil2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
var _FeedDate = require('./FeedDate');
var _FeedDate2 = _interopRequireDefault(_FeedDate);
var _FeedUser = require('./FeedUser');
var _FeedUser2 = _interopRequireDefault(_FeedUser);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* A feed can contain a summary.
*/
function FeedSummary(props) {
var children = props.children,
className = props.className,
content = props.content,
date = props.date,
user = props.user;
var classes = (0, _classnames2.default)('summary', className);
var rest = (0, _lib.getUnhandledProps)(FeedSummary, props);
var ElementType = (0, _lib.getElementType)(FeedSummary, props);
if (!(0, _isNil3.default)(children)) {
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
children
);
}
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
(0, _lib.createShorthand)(_FeedUser2.default, function (val) {
return { content: val };
}, user),
content,
(0, _lib.createShorthand)(_FeedDate2.default, function (val) {
return { content: val };
}, date)
);
}
FeedSummary.handledProps = ['as', 'children', 'className', 'content', 'date', 'user'];
FeedSummary._meta = {
name: 'FeedSummary',
parent: 'Feed',
type: _lib.META.TYPES.VIEW
};
process.env.NODE_ENV !== "production" ? FeedSummary.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string,
/** Shorthand for primary content. */
content: _lib.customPropTypes.contentShorthand,
/** Shorthand for FeedDate. */
date: _lib.customPropTypes.itemShorthand,
/** Shorthand for FeedUser. */
user: _lib.customPropTypes.itemShorthand
} : void 0;
exports.default = FeedSummary;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | 1 1 1 1 1 1 1 1 1 1 1 1 5 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _isNil2 = require('lodash/isNil');
var _isNil3 = _interopRequireDefault(_isNil2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* A feed can contain a user element.
*/
function FeedUser(props) {
var children = props.children,
className = props.className,
content = props.content;
var classes = (0, _classnames2.default)('user', className);
var rest = (0, _lib.getUnhandledProps)(FeedUser, props);
var ElementType = (0, _lib.getElementType)(FeedUser, props);
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
(0, _isNil3.default)(children) ? content : children
);
}
FeedUser.handledProps = ['as', 'children', 'className', 'content'];
FeedUser._meta = {
name: 'FeedUser',
parent: 'Feed',
type: _lib.META.TYPES.VIEW
};
process.env.NODE_ENV !== "production" ? FeedUser.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string,
/** Shorthand for primary content. */
content: _lib.customPropTypes.contentShorthand
} : void 0;
FeedUser.defaultProps = {
as: 'a'
};
exports.default = FeedUser;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = undefined;
var _Feed = require('./Feed');
var _Feed2 = _interopRequireDefault(_Feed);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = _Feed2.default;
|
| File | Statements | Branches | Functions | Lines | |||||
|---|---|---|---|---|---|---|---|---|---|
| Item.js | 85.11% | (40 / 47) | 62.5% | (5 / 8) | 50% | (1 / 2) | 84.78% | (39 / 46) | |
| ItemContent.js | 79.41% | (27 / 34) | 62.5% | (5 / 8) | 50% | (1 / 2) | 78.79% | (26 / 33) | |
| ItemDescription.js | 76.92% | (20 / 26) | 62.5% | (5 / 8) | 33.33% | (1 / 3) | 76% | (19 / 25) | |
| ItemExtra.js | 76.92% | (20 / 26) | 62.5% | (5 / 8) | 33.33% | (1 / 3) | 76% | (19 / 25) | |
| ItemGroup.js | 69.44% | (25 / 36) | 50% | (5 / 10) | 33.33% | (1 / 3) | 68.57% | (24 / 35) | |
| ItemHeader.js | 76.92% | (20 / 26) | 62.5% | (5 / 8) | 33.33% | (1 / 3) | 76% | (19 / 25) | |
| ItemImage.js | 80% | (16 / 20) | 83.33% | (5 / 6) | 33.33% | (1 / 3) | 78.95% | (15 / 19) | |
| ItemMeta.js | 76.92% | (20 / 26) | 62.5% | (5 / 8) | 33.33% | (1 / 3) | 76% | (19 / 25) | |
| index.js | 100% | (7 / 7) | 75% | (3 / 4) | 100% | (1 / 1) | 100% | (6 / 6) |
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 | 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 12 1 1 1 1 1 1 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _isNil2 = require('lodash/isNil');
var _isNil3 = _interopRequireDefault(_isNil2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
var _ItemContent = require('./ItemContent');
var _ItemContent2 = _interopRequireDefault(_ItemContent);
var _ItemDescription = require('./ItemDescription');
var _ItemDescription2 = _interopRequireDefault(_ItemDescription);
var _ItemExtra = require('./ItemExtra');
var _ItemExtra2 = _interopRequireDefault(_ItemExtra);
var _ItemGroup = require('./ItemGroup');
var _ItemGroup2 = _interopRequireDefault(_ItemGroup);
var _ItemHeader = require('./ItemHeader');
var _ItemHeader2 = _interopRequireDefault(_ItemHeader);
var _ItemImage = require('./ItemImage');
var _ItemImage2 = _interopRequireDefault(_ItemImage);
var _ItemMeta = require('./ItemMeta');
var _ItemMeta2 = _interopRequireDefault(_ItemMeta);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* An item view presents large collections of site content for display.
*/
function Item(props) {
var children = props.children,
className = props.className,
content = props.content,
description = props.description,
extra = props.extra,
header = props.header,
image = props.image,
meta = props.meta;
var classes = (0, _classnames2.default)('item', className);
var rest = (0, _lib.getUnhandledProps)(Item, props);
var ElementType = (0, _lib.getElementType)(Item, props);
if (!(0, _isNil3.default)(children)) {
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
children
);
}
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
_ItemImage2.default.create(image),
_react2.default.createElement(_ItemContent2.default, {
content: content,
description: description,
extra: extra,
header: header,
meta: meta
})
);
}
Item.handledProps = ['as', 'children', 'className', 'content', 'description', 'extra', 'header', 'image', 'meta'];
Item._meta = {
name: 'Item',
type: _lib.META.TYPES.VIEW
};
Item.Content = _ItemContent2.default;
Item.Description = _ItemDescription2.default;
Item.Extra = _ItemExtra2.default;
Item.Group = _ItemGroup2.default;
Item.Header = _ItemHeader2.default;
Item.Image = _ItemImage2.default;
Item.Meta = _ItemMeta2.default;
process.env.NODE_ENV !== "production" ? Item.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string,
/** Shorthand for ItemContent component. */
content: _lib.customPropTypes.contentShorthand,
/** Shorthand for ItemDescription component. */
description: _lib.customPropTypes.itemShorthand,
/** Shorthand for ItemExtra component. */
extra: _lib.customPropTypes.itemShorthand,
/** Shorthand for ItemImage component. */
image: _lib.customPropTypes.itemShorthand,
/** Shorthand for ItemHeader component. */
header: _lib.customPropTypes.itemShorthand,
/** Shorthand for ItemMeta component. */
meta: _lib.customPropTypes.itemShorthand
} : void 0;
exports.default = Item;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 | 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 9 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _isNil2 = require('lodash/isNil');
var _isNil3 = _interopRequireDefault(_isNil2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
var _ItemHeader = require('./ItemHeader');
var _ItemHeader2 = _interopRequireDefault(_ItemHeader);
var _ItemDescription = require('./ItemDescription');
var _ItemDescription2 = _interopRequireDefault(_ItemDescription);
var _ItemExtra = require('./ItemExtra');
var _ItemExtra2 = _interopRequireDefault(_ItemExtra);
var _ItemMeta = require('./ItemMeta');
var _ItemMeta2 = _interopRequireDefault(_ItemMeta);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* An item can contain content.
*/
function ItemContent(props) {
var children = props.children,
className = props.className,
content = props.content,
description = props.description,
extra = props.extra,
header = props.header,
meta = props.meta,
verticalAlign = props.verticalAlign;
var classes = (0, _classnames2.default)((0, _lib.useVerticalAlignProp)(verticalAlign), 'content', className);
var rest = (0, _lib.getUnhandledProps)(ItemContent, props);
var ElementType = (0, _lib.getElementType)(ItemContent, props);
if (!(0, _isNil3.default)(children)) {
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
children
);
}
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
_ItemHeader2.default.create(header),
_ItemMeta2.default.create(meta),
_ItemDescription2.default.create(description),
_ItemExtra2.default.create(extra),
content
);
}
ItemContent.handledProps = ['as', 'children', 'className', 'content', 'description', 'extra', 'header', 'meta', 'verticalAlign'];
ItemContent._meta = {
name: 'ItemContent',
parent: 'Item',
type: _lib.META.TYPES.VIEW
};
process.env.NODE_ENV !== "production" ? ItemContent.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string,
/** Shorthand for primary content. */
content: _lib.customPropTypes.contentShorthand,
/** Shorthand for ItemDescription component. */
description: _lib.customPropTypes.itemShorthand,
/** Shorthand for ItemExtra component. */
extra: _lib.customPropTypes.itemShorthand,
/** Shorthand for ItemHeader component. */
header: _lib.customPropTypes.itemShorthand,
/** Shorthand for ItemMeta component. */
meta: _lib.customPropTypes.itemShorthand,
/** Content can specify its vertical alignment. */
verticalAlign: _propTypes2.default.oneOf(_lib.SUI.VERTICAL_ALIGNMENTS)
} : void 0;
exports.default = ItemContent;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | 1 1 1 1 1 1 1 1 1 1 1 1 5 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _isNil2 = require('lodash/isNil');
var _isNil3 = _interopRequireDefault(_isNil2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* An item can contain a description with a single or multiple paragraphs.
*/
function ItemDescription(props) {
var children = props.children,
className = props.className,
content = props.content;
var classes = (0, _classnames2.default)('description', className);
var rest = (0, _lib.getUnhandledProps)(ItemDescription, props);
var ElementType = (0, _lib.getElementType)(ItemDescription, props);
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
(0, _isNil3.default)(children) ? content : children
);
}
ItemDescription.handledProps = ['as', 'children', 'className', 'content'];
ItemDescription._meta = {
name: 'ItemDescription',
parent: 'Item',
type: _lib.META.TYPES.VIEW
};
process.env.NODE_ENV !== "production" ? ItemDescription.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string,
/** Shorthand for primary content. */
content: _lib.customPropTypes.contentShorthand
} : void 0;
ItemDescription.create = (0, _lib.createShorthandFactory)(ItemDescription, function (content) {
return { content: content };
});
exports.default = ItemDescription;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | 1 1 1 1 1 1 1 1 1 1 1 1 5 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _isNil2 = require('lodash/isNil');
var _isNil3 = _interopRequireDefault(_isNil2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* An item can contain extra content meant to be formatted separately from the main content.
*/
function ItemExtra(props) {
var children = props.children,
className = props.className,
content = props.content;
var classes = (0, _classnames2.default)('extra', className);
var rest = (0, _lib.getUnhandledProps)(ItemExtra, props);
var ElementType = (0, _lib.getElementType)(ItemExtra, props);
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
(0, _isNil3.default)(children) ? content : children
);
}
ItemExtra.handledProps = ['as', 'children', 'className', 'content'];
ItemExtra._meta = {
name: 'ItemExtra',
parent: 'Item',
type: _lib.META.TYPES.VIEW
};
process.env.NODE_ENV !== "production" ? ItemExtra.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string,
/** Shorthand for primary content. */
content: _lib.customPropTypes.contentShorthand
} : void 0;
ItemExtra.create = (0, _lib.createShorthandFactory)(ItemExtra, function (content) {
return { content: content };
});
exports.default = ItemExtra;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 | 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 8 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _objectWithoutProperties2 = require('babel-runtime/helpers/objectWithoutProperties');
var _objectWithoutProperties3 = _interopRequireDefault(_objectWithoutProperties2);
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _map2 = require('lodash/map');
var _map3 = _interopRequireDefault(_map2);
var _isNil2 = require('lodash/isNil');
var _isNil3 = _interopRequireDefault(_isNil2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
var _Item = require('./Item');
var _Item2 = _interopRequireDefault(_Item);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* A group of items.
*/
function ItemGroup(props) {
var children = props.children,
className = props.className,
divided = props.divided,
items = props.items,
link = props.link,
relaxed = props.relaxed;
var classes = (0, _classnames2.default)('ui', (0, _lib.useKeyOnly)(divided, 'divided'), (0, _lib.useKeyOnly)(link, 'link'), (0, _lib.useKeyOrValueAndKey)(relaxed, 'relaxed'), 'items', className);
var rest = (0, _lib.getUnhandledProps)(ItemGroup, props);
var ElementType = (0, _lib.getElementType)(ItemGroup, props);
if (!(0, _isNil3.default)(children)) {
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
children
);
}
var itemsJSX = (0, _map3.default)(items, function (item) {
var childKey = item.childKey,
itemProps = (0, _objectWithoutProperties3.default)(item, ['childKey']);
var finalKey = childKey || [itemProps.content, itemProps.description, itemProps.header, itemProps.meta].join('-');
return _react2.default.createElement(_Item2.default, (0, _extends3.default)({}, itemProps, { key: finalKey }));
});
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
itemsJSX
);
}
ItemGroup.handledProps = ['as', 'children', 'className', 'divided', 'items', 'link', 'relaxed'];
ItemGroup._meta = {
name: 'ItemGroup',
type: _lib.META.TYPES.VIEW,
parent: 'Item'
};
process.env.NODE_ENV !== "production" ? ItemGroup.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string,
/** Items can be divided to better distinguish between grouped content. */
divided: _propTypes2.default.bool,
/** Shorthand array of props for Item. */
items: _lib.customPropTypes.collectionShorthand,
/** An item can be formatted so that the entire contents link to another page. */
link: _propTypes2.default.bool,
/** A group of items can relax its padding to provide more negative space. */
relaxed: _propTypes2.default.oneOfType([_propTypes2.default.bool, _propTypes2.default.oneOf(['very'])])
} : void 0;
exports.default = ItemGroup;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | 1 1 1 1 1 1 1 1 1 1 1 1 5 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _isNil2 = require('lodash/isNil');
var _isNil3 = _interopRequireDefault(_isNil2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* An item can contain a header.
*/
function ItemHeader(props) {
var children = props.children,
className = props.className,
content = props.content;
var classes = (0, _classnames2.default)('header', className);
var rest = (0, _lib.getUnhandledProps)(ItemHeader, props);
var ElementType = (0, _lib.getElementType)(ItemHeader, props);
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
(0, _isNil3.default)(children) ? content : children
);
}
ItemHeader.handledProps = ['as', 'children', 'className', 'content'];
ItemHeader._meta = {
name: 'ItemHeader',
parent: 'Item',
type: _lib.META.TYPES.VIEW
};
process.env.NODE_ENV !== "production" ? ItemHeader.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string,
/** Shorthand for primary content. */
content: _lib.customPropTypes.contentShorthand
} : void 0;
ItemHeader.create = (0, _lib.createShorthandFactory)(ItemHeader, function (content) {
return { content: content };
});
exports.default = ItemHeader;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 | 1 1 1 1 1 1 1 1 3 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
var _Image = require('../../elements/Image');
var _Image2 = _interopRequireDefault(_Image);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* An item can contain an image.
*/
function ItemImage(props) {
var size = props.size;
var rest = (0, _lib.getUnhandledProps)(ItemImage, props);
return _react2.default.createElement(_Image2.default, (0, _extends3.default)({}, rest, { size: size, ui: !!size, wrapped: true }));
}
ItemImage.handledProps = ['size'];
ItemImage._meta = {
name: 'ItemImage',
parent: 'Item',
type: _lib.META.TYPES.VIEW
};
process.env.NODE_ENV !== "production" ? ItemImage.propTypes = {
/** An image may appear at different sizes. */
size: _Image2.default.propTypes.size
} : void 0;
ItemImage.create = (0, _lib.createShorthandFactory)(ItemImage, function (src) {
return { src: src };
});
exports.default = ItemImage;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 | 1 1 1 1 1 1 1 1 1 1 1 1 5 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _isNil2 = require('lodash/isNil');
var _isNil3 = _interopRequireDefault(_isNil2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* An item can contain content metadata.
*/
function ItemMeta(props) {
var children = props.children,
className = props.className,
content = props.content;
var classes = (0, _classnames2.default)('meta', className);
var rest = (0, _lib.getUnhandledProps)(ItemMeta, props);
var ElementType = (0, _lib.getElementType)(ItemMeta, props);
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
(0, _isNil3.default)(children) ? content : children
);
}
ItemMeta.handledProps = ['as', 'children', 'className', 'content'];
ItemMeta._meta = {
name: 'ItemMeta',
parent: 'Item',
type: _lib.META.TYPES.VIEW
};
process.env.NODE_ENV !== "production" ? ItemMeta.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string,
/** Shorthand for primary content. */
content: _lib.customPropTypes.contentShorthand
} : void 0;
ItemMeta.create = (0, _lib.createShorthandFactory)(ItemMeta, function (content) {
return { content: content };
});
exports.default = ItemMeta;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = undefined;
var _Item = require('./Item');
var _Item2 = _interopRequireDefault(_Item);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = _Item2.default;
|
| File | Statements | Branches | Functions | Lines | |||||
|---|---|---|---|---|---|---|---|---|---|
| Statistic.js | 81.08% | (30 / 37) | 62.5% | (5 / 8) | 50% | (1 / 2) | 82.86% | (29 / 35) | |
| StatisticGroup.js | 73.53% | (25 / 34) | 50% | (5 / 10) | 33.33% | (1 / 3) | 75% | (24 / 32) | |
| StatisticLabel.js | 79.17% | (19 / 24) | 62.5% | (5 / 8) | 50% | (1 / 2) | 78.26% | (18 / 23) | |
| StatisticValue.js | 79.17% | (19 / 24) | 62.5% | (5 / 8) | 50% | (1 / 2) | 78.26% | (18 / 23) | |
| index.js | 100% | (7 / 7) | 75% | (3 / 4) | 100% | (1 / 1) | 100% | (6 / 6) |
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 | 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 9 1 1 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _without2 = require('lodash/without');
var _without3 = _interopRequireDefault(_without2);
var _isNil2 = require('lodash/isNil');
var _isNil3 = _interopRequireDefault(_isNil2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
var _StatisticGroup = require('./StatisticGroup');
var _StatisticGroup2 = _interopRequireDefault(_StatisticGroup);
var _StatisticLabel = require('./StatisticLabel');
var _StatisticLabel2 = _interopRequireDefault(_StatisticLabel);
var _StatisticValue = require('./StatisticValue');
var _StatisticValue2 = _interopRequireDefault(_StatisticValue);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* A statistic emphasizes the current value of an attribute.
*/
function Statistic(props) {
var children = props.children,
className = props.className,
color = props.color,
floated = props.floated,
horizontal = props.horizontal,
inverted = props.inverted,
label = props.label,
size = props.size,
text = props.text,
value = props.value;
var classes = (0, _classnames2.default)('ui', color, size, (0, _lib.useValueAndKey)(floated, 'floated'), (0, _lib.useKeyOnly)(horizontal, 'horizontal'), (0, _lib.useKeyOnly)(inverted, 'inverted'), 'statistic', className);
var rest = (0, _lib.getUnhandledProps)(Statistic, props);
var ElementType = (0, _lib.getElementType)(Statistic, props);
if (!(0, _isNil3.default)(children)) return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
children
);
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
_react2.default.createElement(_StatisticValue2.default, { text: text, value: value }),
_react2.default.createElement(_StatisticLabel2.default, { label: label })
);
}
Statistic.handledProps = ['as', 'children', 'className', 'color', 'floated', 'horizontal', 'inverted', 'label', 'size', 'text', 'value'];
Statistic._meta = {
name: 'Statistic',
type: _lib.META.TYPES.VIEW
};
process.env.NODE_ENV !== "production" ? Statistic.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string,
/** A statistic can be formatted to be different colors. */
color: _propTypes2.default.oneOf(_lib.SUI.COLORS),
/** A statistic can sit to the left or right of other content. */
floated: _propTypes2.default.oneOf(_lib.SUI.FLOATS),
/** A statistic can present its measurement horizontally. */
horizontal: _propTypes2.default.bool,
/** A statistic can be formatted to fit on a dark background. */
inverted: _propTypes2.default.bool,
/** Label content of the Statistic. */
label: _lib.customPropTypes.contentShorthand,
/** A statistic can vary in size. */
size: _propTypes2.default.oneOf((0, _without3.default)(_lib.SUI.SIZES, 'big', 'massive', 'medium')),
/** Format the StatisticValue with smaller font size to fit nicely beside number values. */
text: _propTypes2.default.bool,
/** Value content of the Statistic. */
value: _lib.customPropTypes.contentShorthand
} : void 0;
Statistic.Group = _StatisticGroup2.default;
Statistic.Label = _StatisticLabel2.default;
Statistic.Value = _StatisticValue2.default;
exports.default = Statistic;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 8 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _without2 = require('lodash/without');
var _without3 = _interopRequireDefault(_without2);
var _map2 = require('lodash/map');
var _map3 = _interopRequireDefault(_map2);
var _isNil2 = require('lodash/isNil');
var _isNil3 = _interopRequireDefault(_isNil2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
var _Statistic = require('./Statistic');
var _Statistic2 = _interopRequireDefault(_Statistic);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* A group of statistics.
*/
function StatisticGroup(props) {
var children = props.children,
className = props.className,
color = props.color,
horizontal = props.horizontal,
inverted = props.inverted,
items = props.items,
size = props.size,
widths = props.widths;
var classes = (0, _classnames2.default)('ui', color, size, (0, _lib.useKeyOnly)(horizontal, 'horizontal'), (0, _lib.useKeyOnly)(inverted, 'inverted'), (0, _lib.useWidthProp)(widths), 'statistics', className);
var rest = (0, _lib.getUnhandledProps)(StatisticGroup, props);
var ElementType = (0, _lib.getElementType)(StatisticGroup, props);
if (!(0, _isNil3.default)(children)) return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
children
);
var itemsJSX = (0, _map3.default)(items, function (item) {
return _react2.default.createElement(_Statistic2.default, (0, _extends3.default)({ key: item.childKey || [item.label, item.title].join('-') }, item));
});
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
itemsJSX
);
}
StatisticGroup.handledProps = ['as', 'children', 'className', 'color', 'horizontal', 'inverted', 'items', 'size', 'widths'];
StatisticGroup._meta = {
name: 'StatisticGroup',
type: _lib.META.TYPES.VIEW,
parent: 'Statistic'
};
process.env.NODE_ENV !== "production" ? StatisticGroup.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string,
/** A statistic group can be formatted to be different colors. */
color: _propTypes2.default.oneOf(_lib.SUI.COLORS),
/** A statistic group can present its measurement horizontally. */
horizontal: _propTypes2.default.bool,
/** A statistic group can be formatted to fit on a dark background. */
inverted: _propTypes2.default.bool,
/** Array of props for Statistic. */
items: _lib.customPropTypes.collectionShorthand,
/** A statistic group can vary in size. */
size: _propTypes2.default.oneOf((0, _without3.default)(_lib.SUI.SIZES, 'big', 'massive', 'medium')),
/** A statistic group can have its items divided evenly. */
widths: _propTypes2.default.oneOf(_lib.SUI.WIDTHS)
} : void 0;
exports.default = StatisticGroup;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 | 1 1 1 1 1 1 1 1 1 1 1 1 5 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _isNil2 = require('lodash/isNil');
var _isNil3 = _interopRequireDefault(_isNil2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* A statistic can contain a label to help provide context for the presented value.
*/
function StatisticLabel(props) {
var children = props.children,
className = props.className,
label = props.label;
var classes = (0, _classnames2.default)('label', className);
var rest = (0, _lib.getUnhandledProps)(StatisticLabel, props);
var ElementType = (0, _lib.getElementType)(StatisticLabel, props);
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
(0, _isNil3.default)(children) ? label : children
);
}
StatisticLabel.handledProps = ['as', 'children', 'className', 'label'];
StatisticLabel._meta = {
name: 'StatisticLabel',
parent: 'Statistic',
type: _lib.META.TYPES.VIEW
};
process.env.NODE_ENV !== "production" ? StatisticLabel.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string,
/** Shorthand for primary content. */
label: _lib.customPropTypes.contentShorthand
} : void 0;
exports.default = StatisticLabel;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 | 1 1 1 1 1 1 1 1 1 1 1 1 5 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
var _extends2 = require('babel-runtime/helpers/extends');
var _extends3 = _interopRequireDefault(_extends2);
var _isNil2 = require('lodash/isNil');
var _isNil3 = _interopRequireDefault(_isNil2);
var _classnames = require('classnames');
var _classnames2 = _interopRequireDefault(_classnames);
var _propTypes = require('prop-types');
var _propTypes2 = _interopRequireDefault(_propTypes);
var _react = require('react');
var _react2 = _interopRequireDefault(_react);
var _lib = require('../../lib');
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
/**
* A statistic can contain a numeric, icon, image, or text value.
*/
function StatisticValue(props) {
var children = props.children,
className = props.className,
text = props.text,
value = props.value;
var classes = (0, _classnames2.default)((0, _lib.useKeyOnly)(text, 'text'), 'value', className);
var rest = (0, _lib.getUnhandledProps)(StatisticValue, props);
var ElementType = (0, _lib.getElementType)(StatisticValue, props);
return _react2.default.createElement(
ElementType,
(0, _extends3.default)({}, rest, { className: classes }),
(0, _isNil3.default)(children) ? value : children
);
}
StatisticValue.handledProps = ['as', 'children', 'className', 'text', 'value'];
StatisticValue._meta = {
name: 'StatisticValue',
parent: 'Statistic',
type: _lib.META.TYPES.VIEW
};
process.env.NODE_ENV !== "production" ? StatisticValue.propTypes = {
/** An element type to render as (string or function). */
as: _lib.customPropTypes.as,
/** Primary content. */
children: _propTypes2.default.node,
/** Additional classes. */
className: _propTypes2.default.string,
/** Format the value with smaller font size to fit nicely beside number values. */
text: _propTypes2.default.bool,
/** Primary content of the StatisticValue. Mutually exclusive with the children prop. */
value: _lib.customPropTypes.contentShorthand
} : void 0;
exports.default = StatisticValue;
|
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 | 1 1 1 1 1 1 | 'use strict';
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = undefined;
var _Statistic = require('./Statistic');
var _Statistic2 = _interopRequireDefault(_Statistic);
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
exports.default = _Statistic2.default;
|